Skip to content

fix(daemon): allow disabling idle-shutdown via GRADATA_DAEMON_IDLE_TIMEOUT#199

Merged
Gradata merged 1 commit into
mainfrom
fix/daemon-disable-idle-shutdown
May 16, 2026
Merged

fix(daemon): allow disabling idle-shutdown via GRADATA_DAEMON_IDLE_TIMEOUT#199
Gradata merged 1 commit into
mainfrom
fix/daemon-disable-idle-shutdown

Conversation

@Gradata

@Gradata Gradata commented May 16, 2026

Copy link
Copy Markdown
Owner

Bug: daemon self-terminates after 10min idle, breaking dashboard Sync Now until the watchdog cron catches up ~5min later. Users perceive intermittent 'Local Gradata daemon not running' errors.

Fix: make IDLE_TIMEOUT_SECONDS env-configurable. Setting GRADATA_DAEMON_IDLE_TIMEOUT=0 disables idle-shutdown entirely. Default unchanged (600s) for backwards compatibility.

Recommended config when daemon is only servicing Sync Now: GRADATA_DAEMON_IDLE_TIMEOUT=0.

Follow-up to #196/#197/#198.

…MEOUT=0

The daemon used to shut itself down after 10 minutes of no requests. That breaks the dashboard Sync Now button until the 5-minute watchdog cron restarts it.

Make IDLE_TIMEOUT_SECONDS env-configurable. Setting GRADATA_DAEMON_IDLE_TIMEOUT=0 disables idle-shutdown entirely — recommended when the daemon is only servicing the dashboard's occasional Sync Now button (long idle stretches are normal).

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7c14e922-5354-4834-aa0a-13b0ea5872e4

📥 Commits

Reviewing files that changed from the base of the PR and between b1ac70f and be3b6d3.

📒 Files selected for processing (1)
  • Gradata/src/gradata/daemon.py

📝 Walkthrough

fix(daemon): allow disabling idle-shutdown via GRADATA_DAEMON_IDLE_TIMEOUT

  • Made daemon's idle auto-shutdown timeout configurable via GRADATA_DAEMON_IDLE_TIMEOUT environment variable (default: 600 seconds)
  • Setting GRADATA_DAEMON_IDLE_TIMEOUT=0 disables idle-shutdown entirely for long-running dashboard scenarios
  • Added early-return optimization in _reset_idle_timer() to skip timer operations when IDLE_TIMEOUT_SECONDS <= 0
  • Backwards compatible — existing behavior unchanged without the environment variable
  • Solves intermittent "Local Gradata daemon not running" errors caused by unexpected idle termination

Walkthrough

The daemon's idle auto-shutdown timeout is now configurable via the GRADATA_DAEMON_IDLE_TIMEOUT environment variable instead of hardcoded to 600 seconds. Setting this variable to 0 disables idle shutdown entirely. The idle timer reset logic early-returns when the timeout is disabled, preventing timer scheduling.

Changes

Configurable idle timeout

Layer / File(s) Summary
Timeout configuration from environment
Gradata/src/gradata/daemon.py
IDLE_TIMEOUT_SECONDS is read from the GRADATA_DAEMON_IDLE_TIMEOUT environment variable with a default of 600 seconds. Setting the variable to 0 disables idle-based shutdown.
Early return when idle shutdown disabled
Gradata/src/gradata/daemon.py
_reset_idle_timer() checks whether IDLE_TIMEOUT_SECONDS <= 0 and returns immediately without scheduling or canceling timers when idle shutdown is disabled.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

bug

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/daemon-disable-idle-shutdown

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 OpenGrep (1.20.0)

OpenGrep fatal error (exit code 2):
┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m
[00.15][ERROR]: Error: exception Glob.Lexer.Syntax_error("malformed glob pattern: missing ']'")
Raised at Glob__Lexer.syntax_error in file "libs/glob/Lexer.mll", line 8, characters 2-26
Called from Glob__Lexer.__ocaml_lex_token_rec in file "libs/glob/Lexer.mll", line 29, characters 26-53
Cal


Comment @coderabbitai help to get the list of available commands and usage tips.

@Gradata Gradata merged commit 0561c82 into main May 16, 2026
0 of 9 checks passed
@Gradata Gradata deleted the fix/daemon-disable-idle-shutdown branch May 16, 2026 19:12
@coderabbitai coderabbitai Bot added the bug Something isn't working label May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant