Skip to content

Commit

Permalink
fix: ema options default value (#106)
Browse files Browse the repository at this point in the history
* fix: ema options default value

* test: close loggers
  • Loading branch information
mariodu authored Jan 26, 2024
1 parent f2c11f6 commit 72345a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/control_plane/worker_stats/broker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,39 +76,39 @@ class Broker {
}

get concurrencySlidingWindowSize() {
return this.#profile.worker.concurrencySlidingWindowSize || 60 * 1000;
return this.#profile.worker.concurrencySlidingWindowSize ?? 60 * 1000;
}

get concurrencySlidingBucketCount() {
return this.#profile.worker.concurrencySlidingBucketCount || 6;
return this.#profile.worker.concurrencySlidingBucketCount ?? 6;
}

get emaConcurrencyAlpha() {
return this.#profile.worker.emaConcurrencyAlpha || 0.5;
return this.#profile.worker.emaConcurrencyAlpha ?? 0.5;
}

get concurrencyExpandThreshold() {
return this.#profile.worker.concurrencyExpandThreshold || 0.7;
return this.#profile.worker.concurrencyExpandThreshold ?? 0.7;
}

get concurrencyShrinkThreshold() {
return this.#profile.worker.concurrencyShrinkThreshold || 0.3;
return this.#profile.worker.concurrencyShrinkThreshold ?? 0.3;
}

get expandCooldown() {
return this.#profile.worker.expandCooldown || 1000;
return this.#profile.worker.expandCooldown ?? 1000;
}

get shrinkCooldown() {
return this.#profile.worker.shrinkCooldown || 60 * 1000;
return this.#profile.worker.shrinkCooldown ?? 60 * 1000;
}

get scaleFactor() {
return this.#profile.worker.scaleFactor || 0.5;
return this.#profile.worker.scaleFactor ?? 0.5;
}

get precisionZeroThreshold() {
return this.#profile.worker.precisionZeroThreshold || 0.01;
return this.#profile.worker.precisionZeroThreshold ?? 0.01;
}

get shrinkCooldownOnStartup() {
Expand Down
4 changes: 4 additions & 0 deletions src/test/prelude.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ import { Loggers, loggers } from '#self/lib/loggers';
before(() => {
loggers.setSink(Loggers.getPrettySink(''));
});

after(() => {
loggers.close();
});

0 comments on commit 72345a5

Please sign in to comment.