Skip to content

Commit

Permalink
fix(jobs): local runner for enterprise (NangoHQ#2212)
Browse files Browse the repository at this point in the history
## Describe your changes
Issues with the runner failing health checks for enterprise. Using a a
remote runner requires the API call from jobs to the runner stay open
for the duration of the sync. This can be problematic as the connection
can drop or be terminated for a number of reasons. This piece of
[code](https://github.com/NangoHQ/nango/blob/master/packages/jobs/lib/integration.service.ts#L124-L133]
should be refactored soon so that this logic is more portable across
different cloud providers besides just our own.

## Issue ticket number and link

## 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
khaliqgant authored May 28, 2024
1 parent abe295c commit 4bfbdff
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/jobs/lib/runner/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function getRunnerId(suffix: string): string {

export async function getOrStartRunner(runnerId: string): Promise<Runner> {
const waitForRunner = async function (runner: Runner): Promise<void> {
const timeoutMs = 5000;
const timeoutMs = isEnterprise ? 60000 : 5000;
let healthCheck = false;
const startTime = Date.now();
while (!healthCheck && Date.now() - startTime < timeoutMs) {
Expand All @@ -56,9 +56,7 @@ export async function getOrStartRunner(runnerId: string): Promise<Runner> {
}
const isRender = process.env['IS_RENDER'] === 'true';
let runner: Runner;
if (isEnterprise) {
runner = await RemoteRunner.getOrStart(runnerId);
} else if (isRender) {
if (isRender) {
runner = await RenderRunner.getOrStart(runnerId);
} else {
runner = await LocalRunner.getOrStart(runnerId);
Expand Down

0 comments on commit 4bfbdff

Please sign in to comment.