File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -193,10 +193,21 @@ private function setIngestProperty($config)
193
193
if (!empty ($ servicesJson ['body ' ]) && property_exists ($ servicesJson ['body ' ], 'services ' )) {
194
194
$ service = $ servicesJson ['body ' ]->services ->service ;
195
195
if (is_array ($ service )) {
196
- // Choose random ingest service.
197
- $ ingestService = $ service [array_rand ($ service )];
196
+ // Filter running ingest services.
197
+ $ running_services = array_filter ($ service , function ($ s ) {
198
+ return $ s ->active && $ s ->online ;
199
+ });
200
+ // If no running services, return.
201
+ if (empty ($ running_services )) {
202
+ return ;
203
+ }
204
+ // Take the first running service.
205
+ $ ingestService = reset ($ running_services );
198
206
} else {
199
- // There is only one.
207
+ // There is only one and is running.
208
+ if (!($ service ->active && $ service ->online )) {
209
+ return ;
210
+ }
200
211
$ ingestService = $ service ;
201
212
}
202
213
You can’t perform that action at this time.
0 commit comments