git-watchtower 1.9.12 → 1.9.14
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 +20 -9
- package/package.json +1 -1
package/bin/git-watchtower.js
CHANGED
|
@@ -1746,11 +1746,15 @@ async function pollGitChanges() {
|
|
|
1746
1746
|
previousBranchStates.set(branch.name, branch.commit);
|
|
1747
1747
|
}
|
|
1748
1748
|
|
|
1749
|
-
// Remove stale entries from
|
|
1749
|
+
// Remove stale entries from caches for branches
|
|
1750
1750
|
// that no longer exist in the current poll results
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1751
|
+
const staleCaches = [previousBranchStates, prInfoCache, store.get('sparklineCache'), store.get('aheadBehindCache')];
|
|
1752
|
+
for (const cache of staleCaches) {
|
|
1753
|
+
if (!cache) continue;
|
|
1754
|
+
for (const name of cache.keys()) {
|
|
1755
|
+
if (!activeBranchNames.has(name)) {
|
|
1756
|
+
cache.delete(name);
|
|
1757
|
+
}
|
|
1754
1758
|
}
|
|
1755
1759
|
}
|
|
1756
1760
|
|
|
@@ -1975,11 +1979,18 @@ async function pollGitChanges() {
|
|
|
1975
1979
|
}
|
|
1976
1980
|
}
|
|
1977
1981
|
|
|
1982
|
+
function schedulePoll() {
|
|
1983
|
+
pollIntervalId = setTimeout(async () => {
|
|
1984
|
+
await pollGitChanges();
|
|
1985
|
+
schedulePoll();
|
|
1986
|
+
}, store.get('adaptivePollInterval'));
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1978
1989
|
function restartPolling() {
|
|
1979
1990
|
if (pollIntervalId) {
|
|
1980
|
-
|
|
1991
|
+
clearTimeout(pollIntervalId);
|
|
1981
1992
|
}
|
|
1982
|
-
|
|
1993
|
+
schedulePoll();
|
|
1983
1994
|
}
|
|
1984
1995
|
|
|
1985
1996
|
// ============================================================================
|
|
@@ -2833,7 +2844,7 @@ async function shutdown() {
|
|
|
2833
2844
|
}
|
|
2834
2845
|
|
|
2835
2846
|
if (fileWatcher) fileWatcher.close();
|
|
2836
|
-
if (pollIntervalId)
|
|
2847
|
+
if (pollIntervalId) clearTimeout(pollIntervalId);
|
|
2837
2848
|
|
|
2838
2849
|
// Stop server based on mode
|
|
2839
2850
|
if (SERVER_MODE === 'command') {
|
|
@@ -3023,8 +3034,8 @@ async function start() {
|
|
|
3023
3034
|
render();
|
|
3024
3035
|
});
|
|
3025
3036
|
|
|
3026
|
-
// Start polling with adaptive interval
|
|
3027
|
-
|
|
3037
|
+
// Start polling with adaptive interval (setTimeout-based to avoid queuing)
|
|
3038
|
+
schedulePoll();
|
|
3028
3039
|
|
|
3029
3040
|
// Initial render
|
|
3030
3041
|
render();
|
package/package.json
CHANGED