refactor(core): Separate listeners in scaling service (no-changelog) (#10487)

This commit is contained in:
Iván Ovejero
2024-08-26 12:35:39 +02:00
committed by GitHub
parent 96e69ad5f2
commit 352aa2a9a4
9 changed files with 149 additions and 210 deletions

View File

@@ -40,8 +40,15 @@ export class InstanceSettings {
readonly instanceId = this.generateInstanceId();
/** Always `leader` in single-main setup. `leader` or `follower` in multi-main setup. */
private instanceRole: InstanceRole = 'unset';
/**
* A main is:
* - `unset` during bootup,
* - `leader` after bootup in single-main setup,
* - `leader` or `follower` after bootup in multi-main setup.
*
* A non-main instance type (e.g. `worker`) is always `unset`.
*/
instanceRole: InstanceRole = 'unset';
get isLeader() {
return this.instanceRole === 'leader';