File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -512,16 +512,13 @@ impl AlertState {
512
512
// from here, the user can only go to Resolved
513
513
if new_state == AlertState :: Resolved {
514
514
// update state on disk and in memory
515
- let guard = ALERTS . write ( ) . await ;
516
- if let Some ( alerts) = guard. as_ref ( ) {
517
- alerts
518
- . update_state ( alert_id, new_state, Some ( "" . into ( ) ) )
519
- . await ?;
520
- }
521
-
522
- // ALERTS
523
- // .update_state(alert_id, new_state, Some("".into()))
524
- // .await?;
515
+ let guard = ALERTS . read ( ) . await ;
516
+ let alerts = guard. as_ref ( ) . ok_or_else ( || {
517
+ AlertError :: CustomError ( "Alert manager not initialized" . into ( ) )
518
+ } ) ?;
519
+ alerts
520
+ . update_state ( alert_id, new_state, Some ( "" . into ( ) ) )
521
+ . await ?;
525
522
} else {
526
523
let msg = format ! ( "Not allowed to manually go from Silenced to {new_state}" ) ;
527
524
return Err ( AlertError :: InvalidStateChange ( msg) ) ;
You can’t perform that action at this time.
0 commit comments