File tree Expand file tree Collapse file tree
services/apps/nango_worker/src/workflows Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { proxyActivities } from '@temporalio/workflow'
1+ import { proxyActivities , sleep } from '@temporalio/workflow'
22
33import * as activities from '../activities/nangoActivities'
44import { ISyncGithubIntegrationArguments } from '../types'
55
66const activity = proxyActivities < typeof activities > ( {
7- startToCloseTimeout : '10 minutes ' ,
7+ startToCloseTimeout : '1 hour ' ,
88} )
99
1010export async function syncGithubIntegration ( args : ISyncGithubIntegrationArguments ) : Promise < void > {
@@ -59,6 +59,12 @@ export async function syncGithubIntegration(args: ISyncGithubIntegrationArgument
5959 await activity . startNangoSync ( result . providerConfigKey , connectionId )
6060
6161 created ++
62+
63+ if ( created < limit ) {
64+ // random delay between 1-5 minutes to not overload nango server
65+ const jitterMs = 60000 + Math . random ( ) * 240000
66+ await sleep ( jitterMs )
67+ }
6268 }
6369 }
6470}
You can’t perform that action at this time.
0 commit comments