Skip to content

Commit

Permalink
Avoid creation of different idle events
Browse files Browse the repository at this point in the history
The events are identified by timestamp which becomes different after +1ms.
  • Loading branch information
2e3s committed Jun 12, 2024
1 parent 1f7ed75 commit d1926eb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ image = { version = "0.25.1" }
members = ["watchers"]

[workspace.package]
version = "0.2.7"
version = "0.2.8"

[workspace.dependencies]
anyhow = "1.0.83"
Expand Down
8 changes: 3 additions & 5 deletions watchers/src/watchers/idle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,17 @@ impl State {
.await?;

// ping with timestamp+1ms with the next event (to ensure the latest event gets retrieved by get_event)
self.last_input_time += Duration::milliseconds(1);
client
.ping(
true,
self.last_input_time + Duration::milliseconds(1),
now - self.last_input_time,
)
.ping(true, self.last_input_time, now - self.last_input_time)
.await
} else {
debug!("Reporting as no longer idle");

client
.ping(true, self.last_input_time, Duration::zero())
.await?;

client
.ping(
false,
Expand Down

0 comments on commit d1926eb

Please sign in to comment.