aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/rbw-agent/agent.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2023-07-18 03:58:57 -0400
committerJesse Luehrs <doy@tozt.net>2023-07-18 03:58:57 -0400
commitdeea6de0641d0438dec3b00d4f5948d41c9f3ef3 (patch)
tree114fd1920f81a09518f8e8e9effb6005b3d03105 /src/bin/rbw-agent/agent.rs
parentd2a97be689b034ed056f3ba41a9775635872a073 (diff)
downloadrbw-deea6de0641d0438dec3b00d4f5948d41c9f3ef3.tar.gz
rbw-deea6de0641d0438dec3b00d4f5948d41c9f3ef3.zip
stop trying to reconnect to notifications so aggressively1.8.0
it adds a bunch of latency to every command otherwise
Diffstat (limited to 'src/bin/rbw-agent/agent.rs')
-rw-r--r--src/bin/rbw-agent/agent.rs31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/bin/rbw-agent/agent.rs b/src/bin/rbw-agent/agent.rs
index fe46e3b..131bab2 100644
--- a/src/bin/rbw-agent/agent.rs
+++ b/src/bin/rbw-agent/agent.rs
@@ -156,26 +156,21 @@ impl Agent {
self.state.lock().await.clear();
}
Event::Sync(()) => {
- // this could fail if we aren't logged in, but we don't
- // care about that
let state = self.state.clone();
tokio::spawn(async move {
- let result = crate::actions::sync(None).await;
- if let Err(e) = result {
- eprintln!("failed to sync: {e:#}");
- } else if !state
- .lock()
- .await
- .notifications_handler
- .is_connected()
- {
- let err =
- crate::actions::subscribe_to_notifications(
- state,
- )
- .await;
- if let Err(e) = err {
- eprintln!("failed to subscribe to notifications: {e:#}");
+ // this could fail if we aren't logged in, but we
+ // don't care about that
+ match crate::actions::sync(None).await {
+ Ok(()) => {
+ if let Err(e) = crate::actions::subscribe_to_notifications(
+ state,
+ )
+ .await {
+ eprintln!("failed to subscribe to notifications: {e:#}");
+ }
+ }
+ Err(e) => {
+ eprintln!("failed to sync: {e:#}");
}
}
});