@@ -414,18 +414,23 @@ fn loop_turn(
414
414
log:: error!( "unexpected response: {:?}" , resp)
415
415
}
416
416
417
- if Some ( resp. id ) == loop_state. configuration_request_id {
417
+ if Some ( & resp. id ) == loop_state. configuration_request_id . as_ref ( ) {
418
418
loop_state. configuration_request_id = None ;
419
+ log:: debug!( "config update response: '{:?}" , resp) ;
419
420
let Response { error, result, .. } = resp;
420
- match ( error, result) {
421
+
422
+ match (
423
+ error,
424
+ result. map ( |result| serde_json:: from_value :: < Vec < ServerConfig > > ( result) ) ,
425
+ ) {
421
426
( Some ( err) , _) => {
422
427
log:: error!( "failed to fetch the server settings: {:?}" , err)
423
428
}
424
- ( None , Some ( result ) ) => {
425
- let new_config = serde_json :: from_value :: < Vec < ServerConfig > > ( result ) ?
429
+ ( None , Some ( Ok ( new_config ) ) ) => {
430
+ let new_config = new_config
426
431
. first ( )
427
432
. expect (
428
- "The client is expected to always send a non-empty config data" ,
433
+ "the client is expected to always send a non-empty config data" ,
429
434
)
430
435
. to_owned ( ) ;
431
436
world_state. update_configuration (
@@ -434,6 +439,9 @@ fn loop_turn(
434
439
get_feature_flags ( & new_config, connection) ,
435
440
) ;
436
441
}
442
+ ( None , Some ( Err ( e) ) ) => {
443
+ log:: error!( "failed to parse client config response: {}" , e)
444
+ }
437
445
( None , None ) => {
438
446
log:: error!( "received empty server settings response from the client" )
439
447
}
0 commit comments