Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(planka-import): skip the owed pause when the window already lapsed

Victor Klomp06f4bf950eff
diff --git a/packages/planka-import/src/kaneo.ts b/packages/planka-import/src/kaneo.ts
index 1fad5298c..d5ca94fd0 100644
--- a/packages/planka-import/src/kaneo.ts
+++ b/packages/planka-import/src/kaneo.ts
@@ -52,7 +52,9 @@ export class KaneoClient {
const release = withResolvers();
KaneoClient.gate = release.promise;
await previous;
- if (KaneoClient.sentInWindow >= REQUESTS_PER_WINDOW) {
+ if (Date.now() >= KaneoClient.windowEndsAt) {
+ KaneoClient.sentInWindow = 0;
+ } else if (KaneoClient.sentInWindow >= REQUESTS_PER_WINDOW) {
const wait = KaneoClient.windowEndsAt - Date.now();
if (wait > 0) await sleep(wait);
KaneoClient.sentInWindow = 0;