File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
22import os
33import subprocess
4- from datetime import datetime
4+ import time
55from pathlib import Path
66from time import sleep
77
@@ -24,7 +24,7 @@ def watch_for_changes():
2424 class MyHandler (FileSystemEventHandler ):
2525 def __init__ (self ):
2626 super ().__init__ ()
27- self .last_build = datetime . now ()
27+ self .last_build = time . time ()
2828
2929 def on_modified (self , event : FileSystemEvent ):
3030 cwd = os .getcwd ()
@@ -50,8 +50,12 @@ def watch_for_changes():
5050 if str (file_path ).startswith (ignored_path ):
5151 return
5252
53+ if self .last_build and time .time () - self .last_build < 0.5 :
54+ return
55+
5356 build_docs ()
5457 refresh_assets ()
58+ self .last_build = time .time ()
5559
5660 event_handler = MyHandler ()
5761 observer = Observer ()
You can’t perform that action at this time.
0 commit comments