mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-22 18:22:41 +00:00
Merge pull request #2035 from balena-os/parallel-start
Start state engine and API binder in parallel
This commit is contained in:
commit
dfcaa2ecb8
@ -59,17 +59,21 @@ export class Supervisor {
|
|||||||
await normaliseLegacyDatabase();
|
await normaliseLegacyDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
await deviceState.loadInitialState();
|
// Start the state engine, the device API and API binder
|
||||||
|
// in parallel
|
||||||
log.info('Starting API server');
|
await Promise.all([
|
||||||
this.api = new SupervisorAPI({
|
deviceState.loadInitialState(),
|
||||||
routers: [apiBinder.router, deviceState.router],
|
(() => {
|
||||||
healthchecks: [apiBinder.healthcheck, deviceState.healthcheck],
|
log.info('Starting API server');
|
||||||
});
|
this.api = new SupervisorAPI({
|
||||||
this.api.listen(conf.listenPort, conf.apiTimeout);
|
routers: [apiBinder.router, deviceState.router],
|
||||||
deviceState.on('shutdown', () => this.api.stop());
|
healthchecks: [apiBinder.healthcheck, deviceState.healthcheck],
|
||||||
|
});
|
||||||
await apiBinder.start();
|
this.api.listen(conf.listenPort, conf.apiTimeout);
|
||||||
|
deviceState.on('shutdown', () => this.api.stop());
|
||||||
|
})(),
|
||||||
|
apiBinder.start(),
|
||||||
|
]);
|
||||||
|
|
||||||
logMonitor.start();
|
logMonitor.start();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user