add a 60 sec. sleep between GitHub calls to avoid rate limits
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
bca825b535
commit
3d122db60d
|
@ -18,6 +18,13 @@ import {
|
||||||
} from "./fetchGithubRepo";
|
} from "./fetchGithubRepo";
|
||||||
import {fromRelationalViews as referenceDetectorFromRelationalViews} from "./referenceDetector";
|
import {fromRelationalViews as referenceDetectorFromRelationalViews} from "./referenceDetector";
|
||||||
|
|
||||||
|
/* sleep helper */
|
||||||
|
function sleep(seconds){
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(resolve, seconds*1000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export interface Loader {
|
export interface Loader {
|
||||||
declaration(): PluginDeclaration;
|
declaration(): PluginDeclaration;
|
||||||
updateMirror(
|
updateMirror(
|
||||||
|
@ -59,6 +66,8 @@ export async function updateMirror(
|
||||||
cache,
|
cache,
|
||||||
});
|
});
|
||||||
reporter.finish(taskId);
|
reporter.finish(taskId);
|
||||||
|
/* to avoid hitting GH API rate limits */
|
||||||
|
await sleep(60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue