git-watchtower 1.9.13 → 1.9.15

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.
@@ -1647,7 +1647,6 @@ async function pollGitChanges() {
1647
1647
  const newInterval = Math.min(store.get('adaptivePollInterval') * 2, 60000);
1648
1648
  store.setState({ adaptivePollInterval: newInterval });
1649
1649
  addLog(`Polling interval increased to ${newInterval / 1000}s`, 'info');
1650
- restartPolling();
1651
1650
  } else if (lastFetchDuration > 15000 && !slowFetchWarningShown) {
1652
1651
  addLog(`Fetches taking ${Math.round(lastFetchDuration / 1000)}s`, 'warning');
1653
1652
  slowFetchWarningShown = true;
@@ -1658,7 +1657,6 @@ async function pollGitChanges() {
1658
1657
  if (store.get('adaptivePollInterval') > GIT_POLL_INTERVAL) {
1659
1658
  store.setState({ adaptivePollInterval: GIT_POLL_INTERVAL });
1660
1659
  addLog(`Polling interval restored to ${GIT_POLL_INTERVAL / 1000}s`, 'info');
1661
- restartPolling();
1662
1660
  }
1663
1661
  }
1664
1662
 
@@ -1979,11 +1977,18 @@ async function pollGitChanges() {
1979
1977
  }
1980
1978
  }
1981
1979
 
1980
+ function schedulePoll() {
1981
+ pollIntervalId = setTimeout(async () => {
1982
+ await pollGitChanges();
1983
+ schedulePoll();
1984
+ }, store.get('adaptivePollInterval'));
1985
+ }
1986
+
1982
1987
  function restartPolling() {
1983
1988
  if (pollIntervalId) {
1984
- clearInterval(pollIntervalId);
1989
+ clearTimeout(pollIntervalId);
1985
1990
  }
1986
- pollIntervalId = setInterval(pollGitChanges, store.get('adaptivePollInterval'));
1991
+ schedulePoll();
1987
1992
  }
1988
1993
 
1989
1994
  // ============================================================================
@@ -2837,7 +2842,7 @@ async function shutdown() {
2837
2842
  }
2838
2843
 
2839
2844
  if (fileWatcher) fileWatcher.close();
2840
- if (pollIntervalId) clearInterval(pollIntervalId);
2845
+ if (pollIntervalId) clearTimeout(pollIntervalId);
2841
2846
 
2842
2847
  // Stop server based on mode
2843
2848
  if (SERVER_MODE === 'command') {
@@ -3027,8 +3032,8 @@ async function start() {
3027
3032
  render();
3028
3033
  });
3029
3034
 
3030
- // Start polling with adaptive interval
3031
- pollIntervalId = setInterval(pollGitChanges, store.get('adaptivePollInterval'));
3035
+ // Start polling with adaptive interval (setTimeout-based to avoid queuing)
3036
+ schedulePoll();
3032
3037
 
3033
3038
  // Initial render
3034
3039
  render();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-watchtower",
3
- "version": "1.9.13",
3
+ "version": "1.9.15",
4
4
  "description": "Terminal-based Git branch monitor with activity sparklines and optional dev server with live reload",
5
5
  "main": "bin/git-watchtower.js",
6
6
  "bin": {