fix(controller): push workers before configs on apiserver join

on_apiserver_join pushed configs first, then workers. The API server's
OnHostConfigUpdated only applies config-sourced fields (max_slot,
host_type/host_model) to hosts already in its store — so on a fresh
connect every host was skipped and the API showed max_slot 0 and t1
host_type "unknown". Swap the order so the worker dataset populates the
host entries before the config push lands.

Verified on t1/t2/t3: all hosts now report max_slot 8 and
host_type x86_64-linux-gnu; jobs still submit → RUN → DONE.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-08-24 14:17:50 +00:00
parent 06887985b4
commit 125a8b283e

View file

@ -647,8 +647,14 @@ int apiserver_init(cluster_t* c)
int on_apiserver_join(cluster_t* c, endpoint_t* ep)
{
xce_apiserver_push_configs(c, ep);
/* Push the WORKER dataset BEFORE the config push. The API server's
* OnHostConfigUpdated only applies config-sourced fields (max_slot,
* host_type/host_model) to hosts already in its store — if the config
* push arrives first, every host is skipped (bug: hosts showed max_slot
* 0 and t1 host_type "unknown" on first connect). Pushing workers first
* populates the host entries so the config push lands. */
xce_apiserver_push_workers(c, ep);
xce_apiserver_push_configs(c, ep);
xce_apiserver_push_jobs(c, ep);
return 0;