diff --git a/coordinator/src/bin/coordinator.rs b/coordinator/src/bin/coordinator.rs index c05fc9314..bd2128699 100644 --- a/coordinator/src/bin/coordinator.rs +++ b/coordinator/src/bin/coordinator.rs @@ -47,7 +47,11 @@ const EXPIRED_POSITION_SYNC_INTERVAL: Duration = Duration::from_secs(5 * 60); const CLOSED_POSITION_SYNC_INTERVAL: Duration = Duration::from_secs(30); const UNREALIZED_PNL_SYNC_INTERVAL: Duration = Duration::from_secs(10 * 60); const CONNECTION_CHECK_INTERVAL: Duration = Duration::from_secs(30); -const EXPIRED_POSITION_NOTIFICATION_INTERVAL: Duration = Duration::from_secs(30 * 60); +/// How often to check for expiring/expired positions to send push notifications for. +/// This should be configured in conjunction with the time windows of +/// expiring/expired notifications, ideally a bit less than the time window +/// (e.g. 58min for a 1h time window). +const POSITION_PUSH_NOTIFICATION_INTERVAL: Duration = Duration::from_secs(58 * 60); const NODE_ALIAS: &str = "10101.finance"; @@ -277,6 +281,7 @@ async fn main() -> Result<()> { let pool = pool.clone(); async move { loop { + tracing::debug!("Running expiring/expired position push notification task"); match pool.get() { Ok(mut conn) => { if let Err(e) = @@ -290,7 +295,7 @@ async fn main() -> Result<()> { } } - tokio::time::sleep(EXPIRED_POSITION_NOTIFICATION_INTERVAL).await; + tokio::time::sleep(POSITION_PUSH_NOTIFICATION_INTERVAL).await; } } });