Skip to content

Commit 6853548

Browse files
committed
Move else for successful post to match branch of unsuccessful branch
1 parent 20db18e commit 6853548

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/counter.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,8 @@ export class Counters extends EventEmitter {
117117

118118
private startTimer(): void {
119119
if (this.disabled || this.getInterval() === 0) {
120-
console.log('counters was disabled');
121120
return;
122121
}
123-
console.log('Starting timer');
124122
this.timer = setTimeout(() => {
125123
this.sendCounters();
126124
}, this.getInterval());
@@ -157,7 +155,6 @@ export class Counters extends EventEmitter {
157155
UnleashEvents.Warn,
158156
`${url} returning ${statusCode}. Backing off to ${this.failures} times normal interval`,
159157
);
160-
console.log('Failed. Backing off');
161158
this.startTimer();
162159
}
163160

@@ -183,7 +180,6 @@ export class Counters extends EventEmitter {
183180
const payload = this.createCounterData();
184181

185182
const headers = this.customHeadersFunction ? await this.customHeadersFunction() : this.headers;
186-
console.log(`Posting counters for ${url}`);
187183
try {
188184
const res = await post({
189185
url,
@@ -204,11 +200,10 @@ export class Counters extends EventEmitter {
204200
res.status === 504
205201
) {
206202
this.backoff(url, res.status);
207-
} else {
208-
console.log('Successfully sent payload. Calling reduce backoff');
209-
this.emit(UnleashEvents.Sent, payload);
210-
this.reduceBackoff();
211203
}
204+
} else {
205+
this.emit(UnleashEvents.Sent, payload);
206+
this.reduceBackoff();
212207
}
213208
} catch (err) {
214209
this.emit(UnleashEvents.Warn, err);
@@ -217,7 +212,6 @@ export class Counters extends EventEmitter {
217212
}
218213

219214
reduceBackoff(): void {
220-
console.log(`Reducing backoff... Failures now ${this.getFailures()}`);
221215
this.failures = Math.max(0, this.failures - 1);
222216
this.startTimer();
223217
}

0 commit comments

Comments
 (0)