File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,10 @@ impl Instance {
109
109
}
110
110
111
111
pub async fn get_online_count ( & self ) -> i32 {
112
- self . get_info ( ) . await . unwrap ( ) . players . online as i32
112
+ match self . get_info ( ) . await {
113
+ Ok ( status) => status. players . online as i32 ,
114
+ Err ( _) => 0 ,
115
+ }
113
116
}
114
117
115
118
pub async fn get_available_slots ( & self ) -> i32 {
Original file line number Diff line number Diff line change @@ -87,17 +87,11 @@ impl Task for HubTask {
87
87
let mut hub_option = None ;
88
88
89
89
for instance in hubs_ready {
90
- let info_result = instance. get_info ( ) . await ;
90
+ let online_player = instance. get_online_count ( ) . await ;
91
91
92
- if let Ok ( info) = info_result {
93
- let online_player = info. players . online ;
94
-
95
- if instance. get_state ( ) == EpsilonState :: Running
96
- && online_player <= n
97
- {
98
- n = online_player;
99
- hub_option = Some ( instance) ;
100
- }
92
+ if instance. get_state ( ) == EpsilonState :: Running && online_player <= n {
93
+ n = online_player;
94
+ hub_option = Some ( instance) ;
101
95
}
102
96
}
103
97
You can’t perform that action at this time.
0 commit comments