File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
nym-vpn-core/crates/nym-statistics Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 11CREATE TABLE pending_session_report (
22 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
3- day DATE NOT NULL ,
3+ day_utc DATE NOT NULL ,
44 connection_time_ms INTEGER NOT NULL ,
55 retry_attempt INTEGER NOT NULL ,
66 session_duration_min INTEGER NOT NULL ,
Original file line number Diff line number Diff line change @@ -286,15 +286,17 @@ impl InnerHandler {
286286 return ;
287287 }
288288 Some ( event) => {
289- if let Some ( changes ) = self . update_sending_policy( event) {
289+ if let Some ( new_allowed ) = self . update_sending_policy( event) {
290290 // Handle policy changes
291- if changes {
292- timer. as_mut( ) . set( tokio:: time:: sleep( SendingConfig :: random_small_delay( ) ) . fuse( ) ) ;
291+ if new_allowed {
292+ let next_delay = SendingConfig :: random_small_delay( ) ;
293+ tracing:: debug!( "Stats report conditions are met, trying to send in {} secs" , next_delay. as_secs( ) ) ;
294+ timer. as_mut( ) . set( tokio:: time:: sleep( next_delay) . fuse( ) ) ;
293295
294296 } else {
295297 // We can't send, we need to abort
296298 timer. as_mut( ) . set( tokio:: time:: sleep( SendingConfig :: random_big_delay( ) ) . fuse( ) ) ;
297- tracing:: debug!( "Stats report conditions not met, canceling sending task" ) ;
299+ tracing:: debug!( "Stats report conditions not met, canceling sending task (if it was running) " ) ;
298300 sending_task. set( Fuse :: terminated( ) ) ;
299301 }
300302 }
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ impl SqliteStatsStorageManager {
4747 report : & SessionReport ,
4848 ) -> Result < ( ) , StatsStorageError > {
4949 sqlx:: query!(
50- r#"INSERT INTO pending_session_report (day ,
50+ r#"INSERT INTO pending_session_report (day_utc ,
5151 connection_time_ms,
5252 retry_attempt,
5353 session_duration_min,
@@ -77,7 +77,7 @@ impl SqliteStatsStorageManager {
7777 Ok ( sqlx:: query_as (
7878 r#"SELECT
7979 id,
80- day ,
80+ day_utc ,
8181 connection_time_ms,
8282 retry_attempt,
8383 session_duration_min,
You can’t perform that action at this time.
0 commit comments