瀏覽代碼

Merge pull request #1033 from Demonthos/fix-multiple-edits-per-second-hot-reload

Jon Kelley 2 年之前
父節點
當前提交
0527cff3a5
共有 1 個文件被更改,包括 2 次插入3 次删除
  1. 2 3
      packages/hot-reload/src/lib.rs

+ 2 - 3
packages/hot-reload/src/lib.rs

@@ -194,7 +194,6 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(cfg: Config<Ctx>) {
                                 println!("Connected to hot reloading 🚀");
                             }
                         }
-                        std::thread::sleep(std::time::Duration::from_millis(10));
                         if *aborted.lock().unwrap() {
                             break;
                         }
@@ -250,7 +249,7 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(cfg: Config<Ctx>) {
                 };
 
                 for evt in rx {
-                    if chrono::Local::now().timestamp() > last_update_time {
+                    if chrono::Local::now().timestamp_millis() >= last_update_time {
                         if let Ok(evt) = evt {
                             let real_paths = evt
                                 .paths
@@ -322,7 +321,7 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(cfg: Config<Ctx>) {
                                 }
                             }
                         }
-                        last_update_time = chrono::Local::now().timestamp();
+                        last_update_time = chrono::Local::now().timestamp_millis();
                     }
                 }
             });