| ... | @@ -172,10 +172,10 @@ pub fn start(self: *Progress, name: []const u8, estimated_total_items: usize) *N | ... | @@ -172,10 +172,10 @@ pub fn start(self: *Progress, name: []const u8, estimated_total_items: usize) *N |
| 172 | /// Updates the terminal if enough time has passed since last update. Thread-safe. | 172 | /// Updates the terminal if enough time has passed since last update. Thread-safe. |
| 173 | pub fn maybeRefresh(self: *Progress) void { | 173 | pub fn maybeRefresh(self: *Progress) void { |
| 174 | if (self.timer) |*timer| { | 174 | if (self.timer) |*timer| { |
| 175 | const now = timer.read(); | | |
| 176 | if (now < self.initial_delay_ns) return; | | |
| 177 | if (!self.update_mutex.tryLock()) return; | 175 | if (!self.update_mutex.tryLock()) return; |
| 178 | defer self.update_mutex.unlock(); | 176 | defer self.update_mutex.unlock(); |
| | 177 | const now = timer.read(); |
| | 178 | if (now < self.initial_delay_ns) return; |
| 179 | // TODO I have observed this to happen sometimes. I think we need to follow Rust's | 179 | // TODO I have observed this to happen sometimes. I think we need to follow Rust's |
| 180 | // lead and guarantee monotonically increasing times in the std lib itself. | 180 | // lead and guarantee monotonically increasing times in the std lib itself. |
| 181 | if (now < self.prev_refresh_timestamp) return; | 181 | if (now < self.prev_refresh_timestamp) return; |