Skip to content

Commit

Permalink
chore: do not log initial state of AutoscaledPool
Browse files Browse the repository at this point in the history
It's always empty, no need to log that.
  • Loading branch information
B4nan committed Jul 26, 2022
1 parent 8fbb3e8 commit 5c4df89
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/core/src/autoscaling/autoscaled_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class AutoscaledPool {
private _desiredConcurrency: number;
private _currentConcurrency = 0;
private isStopped = false;
private lastLoggingTime = 0;
private lastLoggingTime?: number;
private resolve: ((val?: unknown) => void) | null = null;
private reject: ((reason?: unknown) => void) | null = null;
private snapshotter: Snapshotter;
Expand Down Expand Up @@ -274,7 +274,6 @@ export class AutoscaledPool {
this._desiredConcurrency = desiredConcurrency ?? minConcurrency;
this._currentConcurrency = 0;
this.isStopped = false;
this.lastLoggingTime = 0;
this.resolve = null;
this.reject = null;
this._autoscale = this._autoscale.bind(this);
Expand Down Expand Up @@ -592,7 +591,10 @@ export class AutoscaledPool {
// On periodic intervals, print comprehensive log information
if (this.loggingIntervalMillis > 0) {
const now = Date.now();
if (now > this.lastLoggingTime + this.loggingIntervalMillis) {

if (this.lastLoggingTime == null) {
this.lastLoggingTime = now;
} else if (now > this.lastLoggingTime + this.loggingIntervalMillis) {
this.lastLoggingTime = now;
this.log.info('state', {
currentConcurrency: this._currentConcurrency,
Expand Down

0 comments on commit 5c4df89

Please sign in to comment.