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 8486c0c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 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
4 changes: 3 additions & 1 deletion watchers/src/watchers/idle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ 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),
self.last_input_time,
now - self.last_input_time,
)
.await
Expand All @@ -95,6 +96,7 @@ impl State {
client
.ping(true, self.last_input_time, Duration::zero())
.await?;

client
.ping(
false,
Expand Down

0 comments on commit 8486c0c

Please sign in to comment.