feat(election-iomgr-refactor): restructure myapp_run to fully non-blocking async startup — task 5.1
This commit is contained in:
parent
757558bb33
commit
2e5681387a
4 changed files with 256 additions and 134 deletions
|
|
@ -920,15 +920,25 @@ int cluster_init_phase2(cluster_t* c)
|
|||
vtaskmgr_init(&(c->vtaskmgr), nvcpus);
|
||||
}
|
||||
|
||||
delaymgr_init(&(c->delaymgr), 200 /* precision_ms */, run_delay_tasks);
|
||||
/* Guard: myapp_run() calls delaymgr_init + delaymgr_start before election
|
||||
* (needed for election timeout watchdog via delay_task_ms).
|
||||
* Skip re-init on the two-phase path; run on the legacy cluster_init() path
|
||||
* where delaymgr has not been initialized yet (precision_ms == 0). */
|
||||
if (c->delaymgr.precision_ms == 0) {
|
||||
delaymgr_init(&(c->delaymgr), 200 /* precision_ms */, run_delay_tasks);
|
||||
}
|
||||
|
||||
apiserver_init(c);
|
||||
|
||||
/* Persistence: derive paths and init WAL/snapshot directories.
|
||||
* Recovery is deferred until after cluster_build_resources() runs inside
|
||||
* the HOOK_AFTER_EVENT below so that resmgr is fully populated before
|
||||
* restore_worker() tries to register per-host resource values. */
|
||||
{
|
||||
* restore_worker() tries to register per-host resource values.
|
||||
*
|
||||
* Guard: myapp_run() calls persist_set_workdir + persist_init + persist_start
|
||||
* before election (so WAL is ready when cluster_init_phase2 fires from vtask
|
||||
* context after election). Skip re-init if wal_path is already set. */
|
||||
if (c->persist.wal_path[0] == '\0') {
|
||||
const char* workdir = c->myconf->workdir ? c->myconf->workdir
|
||||
: DEFAULT_WORKDIR;
|
||||
const char* name = c->myconf->name ? c->myconf->name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue