@@ -106,7 +106,7 @@ pub async fn pegboard_client(ctx: &mut WorkflowCtx, input: &Input) -> GlobalResu
106106 config,
107107 system,
108108 } ) ,
109- activity ( UpdateMetricsInput { client_id, flavor } ) ,
109+ activity ( UpdateMetricsInput { client_id, flavor, clear : false } ) ,
110110 ) )
111111 . await ?;
112112 }
@@ -118,7 +118,7 @@ pub async fn pegboard_client(ctx: &mut WorkflowCtx, input: &Input) -> GlobalResu
118118 client_id,
119119 events : events. clone ( ) ,
120120 } ) ,
121- activity ( UpdateMetricsInput { client_id, flavor } ) ,
121+ activity ( UpdateMetricsInput { client_id, flavor, clear : false } ) ,
122122 ) )
123123 . await ?;
124124
@@ -243,6 +243,8 @@ pub async fn pegboard_client(ctx: &mut WorkflowCtx, input: &Input) -> GlobalResu
243243 } )
244244 . await ?;
245245
246+ ctx. activity ( UpdateMetricsInput { client_id : input. client_id , flavor : input. flavor , clear : true } ) . await ?;
247+
246248 let actors = ctx
247249 . activity ( FetchRemainingActorsInput {
248250 client_id : input. client_id ,
@@ -673,7 +675,7 @@ pub async fn handle_commands(
673675 activity ( InsertCommandsInput {
674676 commands : raw_commands. clone ( ) ,
675677 } ) ,
676- activity ( UpdateMetricsInput { client_id, flavor } ) ,
678+ activity ( UpdateMetricsInput { client_id, flavor, clear : false } ) ,
677679 ) )
678680 . await ?;
679681
@@ -914,11 +916,14 @@ async fn check_expired(ctx: &ActivityCtx, input: &CheckExpiredInput) -> GlobalRe
914916struct UpdateMetricsInput {
915917 client_id : Uuid ,
916918 flavor : ClientFlavor ,
919+ clear : bool ,
917920}
918921
919922#[ activity( UpdateMetrics ) ]
920923async fn update_metrics ( ctx : & ActivityCtx , input : & UpdateMetricsInput ) -> GlobalResult < ( ) > {
921- let ( memory, cpu) =
924+ let ( memory, cpu) = if input. clear {
925+ ( 0 , 0 )
926+ } else {
922927 ctx. fdb ( )
923928 . await ?
924929 . run ( |tx, _mc| async move {
@@ -966,7 +971,8 @@ async fn update_metrics(ctx: &ActivityCtx, input: &UpdateMetricsInput) -> Global
966971 ) )
967972 } )
968973 . custom_instrument ( tracing:: info_span!( "client_update_metrics_tx" ) )
969- . await ?;
974+ . await ?
975+ } ;
970976
971977 metrics:: CLIENT_CPU_ALLOCATED
972978 . with_label_values ( & [ & input. client_id . to_string ( ) , & input. flavor . to_string ( ) ] )
0 commit comments