repowisestage 0.0.74 → 0.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/repowise.js +9 -5
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -11064,6 +11064,14 @@ function decodeEmailFromIdToken(idToken) {
|
|
|
11064
11064
|
return null;
|
|
11065
11065
|
}
|
|
11066
11066
|
}
|
|
11067
|
+
async function maybeRefreshOnWake(wakeDrift, pollIntervalMs) {
|
|
11068
|
+
if (wakeDrift <= pollIntervalMs + 6e4)
|
|
11069
|
+
return false;
|
|
11070
|
+
console.log(`[wake] ~${Math.round(wakeDrift / 1e3).toString()}s gap detected (likely sleep) \u2014 verifying token (refresh only if stale)`);
|
|
11071
|
+
await getValidCredentials().catch(() => {
|
|
11072
|
+
});
|
|
11073
|
+
return true;
|
|
11074
|
+
}
|
|
11067
11075
|
async function handleSyncCompleted(notif, ctx) {
|
|
11068
11076
|
if (!notif.commitSha) {
|
|
11069
11077
|
console.warn(`sync.completed for ${notif.repoId} has no commitSha`);
|
|
@@ -11738,11 +11746,7 @@ async function startListener() {
|
|
|
11738
11746
|
let lastCycleAt = Date.now();
|
|
11739
11747
|
while (running) {
|
|
11740
11748
|
const wakeDrift = Date.now() - lastCycleAt;
|
|
11741
|
-
|
|
11742
|
-
console.log(`[wake] ~${Math.round(wakeDrift / 1e3).toString()}s gap detected (likely sleep) \u2014 refreshing credentials`);
|
|
11743
|
-
await getValidCredentials({ forceRefresh: true }).catch(() => {
|
|
11744
|
-
});
|
|
11745
|
-
}
|
|
11749
|
+
await maybeRefreshOnWake(wakeDrift, pollIntervalMs);
|
|
11746
11750
|
lastCycleAt = Date.now();
|
|
11747
11751
|
let anyAuthError = null;
|
|
11748
11752
|
let authErrorGroup = null;
|