mirror of
https://github.com/2e3s/awatcher.git
synced 2025-06-06 11:35:46 +00:00
Avoid creation of different idle events
The events are identified by timestamp which becomes different after +1ms.
This commit is contained in:
parent
1f7ed75a0b
commit
d1926ebdc9
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -503,7 +503,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "awatcher"
|
name = "awatcher"
|
||||||
version = "0.2.7"
|
version = "0.2.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"aw-datastore",
|
"aw-datastore",
|
||||||
@ -4031,7 +4031,7 @@ checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "watchers"
|
name = "watchers"
|
||||||
version = "0.2.7"
|
version = "0.2.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@ -18,7 +18,7 @@ image = { version = "0.25.1" }
|
|||||||
members = ["watchers"]
|
members = ["watchers"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.2.7"
|
version = "0.2.8"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
anyhow = "1.0.83"
|
anyhow = "1.0.83"
|
||||||
|
@ -82,12 +82,9 @@ impl State {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// ping with timestamp+1ms with the next event (to ensure the latest event gets retrieved by get_event)
|
// 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
|
client
|
||||||
.ping(
|
.ping(true, self.last_input_time, now - self.last_input_time)
|
||||||
true,
|
|
||||||
self.last_input_time + Duration::milliseconds(1),
|
|
||||||
now - self.last_input_time,
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
} else {
|
} else {
|
||||||
debug!("Reporting as no longer idle");
|
debug!("Reporting as no longer idle");
|
||||||
@ -95,6 +92,7 @@ impl State {
|
|||||||
client
|
client
|
||||||
.ping(true, self.last_input_time, Duration::zero())
|
.ping(true, self.last_input_time, Duration::zero())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
client
|
client
|
||||||
.ping(
|
.ping(
|
||||||
false,
|
false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user