File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
crates/rpc/src/bin/metric_exporter Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ async fn main() -> Result<()> {
103103 routes ! [
104104 metrics_endpoint,
105105 start_server,
106+ server_unavailable,
106107 start_game,
107108 end_game,
108109 player_joined,
@@ -133,6 +134,11 @@ fn start_server(state: &State<LocalState>) {
133134 state. metrics . start_server ( ) ;
134135}
135136
137+ #[ post( "/server_unavailable" ) ]
138+ fn server_unavailable ( state : & State < LocalState > ) {
139+ state. metrics . server_unavailable ( ) ;
140+ }
141+
136142#[ post( "/start_game" ) ]
137143fn start_game ( state : & State < LocalState > ) {
138144 state. metrics . start_game ( ) ;
Original file line number Diff line number Diff line change @@ -156,6 +156,12 @@ impl Metrics {
156156 self . game_state . set ( GameState :: Waiting . into ( ) ) ;
157157 self . players_current . set ( 0 ) ;
158158 }
159+
160+ pub fn server_unavailable ( & self ) {
161+ self . game_state . set ( GameState :: Done . into ( ) ) ;
162+ self . games_current . set ( 0 ) ;
163+ self . players_current . set ( 0 ) ;
164+ }
159165
160166 pub fn start_game ( & self ) {
161167 self . games_current . set ( 1 ) ;
You can’t perform that action at this time.
0 commit comments