git-watchtower 1.12.4 → 1.12.5
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/bin/git-watchtower.js +8 -0
- package/package.json +1 -1
package/bin/git-watchtower.js
CHANGED
|
@@ -2059,13 +2059,21 @@ async function pollGitChanges() {
|
|
|
2059
2059
|
}
|
|
2060
2060
|
|
|
2061
2061
|
function schedulePoll() {
|
|
2062
|
+
// Bail out if shutdown has started: both here (no new timer) and again
|
|
2063
|
+
// inside the timer callback after each await (the in-flight poll may
|
|
2064
|
+
// have started before shutdown() cleared pollIntervalId, and clearTimeout
|
|
2065
|
+
// on a timer whose callback is already executing is a no-op).
|
|
2066
|
+
if (isShuttingDown) return;
|
|
2062
2067
|
pollIntervalId = setTimeout(async () => {
|
|
2068
|
+
if (isShuttingDown) return;
|
|
2063
2069
|
await pollGitChanges();
|
|
2070
|
+
if (isShuttingDown) return;
|
|
2064
2071
|
schedulePoll();
|
|
2065
2072
|
}, store.get('adaptivePollInterval'));
|
|
2066
2073
|
}
|
|
2067
2074
|
|
|
2068
2075
|
function restartPolling() {
|
|
2076
|
+
if (isShuttingDown) return;
|
|
2069
2077
|
if (pollIntervalId) {
|
|
2070
2078
|
clearTimeout(pollIntervalId);
|
|
2071
2079
|
}
|
package/package.json
CHANGED