Skip to content

Commit

Permalink
fix: do not idle runner if idleMaxDurationMs is 0 (NangoHQ#1949)
Browse files Browse the repository at this point in the history
## Describe your changes
Introduced a bug in https://github.com/NangoHQ/nango/pull/1943/files
which cause runner with max idle time set to zero like the default
runner or paying customer to idle all the time.

## Checklist before requesting a review (skip if just adding/editing
APIs & templates)
- [ ] I added tests, otherwise the reason is: 
- [ ] I added observability, otherwise the reason is:
- [ ] I added analytics, otherwise the reason is:
  • Loading branch information
TBonnin authored Apr 3, 2024
1 parent d3c521a commit 5cdc7bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/runner/lib/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class RunnerMonitor {
private checkIdle(): NodeJS.Timeout {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
return setInterval(async () => {
if (this.tracked.size == 0) {
if (this.idleMaxDurationMs > 0 && this.tracked.size == 0) {
const idleTimeMs = Date.now() - this.lastIdleTrackingDate;
if (idleTimeMs > this.idleMaxDurationMs) {
logger.info(`Runner '${this.runnerId}' idle for more than ${this.idleMaxDurationMs}ms`);
Expand Down

0 comments on commit 5cdc7bc

Please sign in to comment.