Skip to content

Commit

Permalink
refactor(internal): remove global updateRubyGemsVersions (#6199)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed May 11, 2020
1 parent 6104c46 commit 3dbabad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 6 additions & 4 deletions lib/datasource/rubygems/get-rubygems-org.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ function isDataStale(): boolean {
return minutesElapsed >= 5;
}

let _updateRubyGemsVersions: Promise<void> | undefined;

async function syncVersions(): Promise<void> {
if (isDataStale()) {
global.updateRubyGemsVersions =
_updateRubyGemsVersions =
// eslint-disable-next-line @typescript-eslint/no-misused-promises
global.updateRubyGemsVersions || updateRubyGemsVersions();
await global.updateRubyGemsVersions;
delete global.updateRubyGemsVersions;
_updateRubyGemsVersions || updateRubyGemsVersions();
await _updateRubyGemsVersions;
_updateRubyGemsVersions = null;
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ declare namespace NodeJS {
renovateCache: Renovate.Cache;

trustLevel?: string;

updateRubyGemsVersions?: Promise<void>;
}
}

Expand Down

0 comments on commit 3dbabad

Please sign in to comment.