Fix scheduler to read check interval from config each cycle
Previously the scheduler used the instance variable set at initialization, ignoring config changes. Now it reads check_interval_hours from the config database each cycle, allowing users to change the interval without restarting. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
ae68617528
commit
20aa859c8e
@@ -114,8 +114,9 @@ class UpdateScheduler:
|
||||
|
||||
try:
|
||||
while not self._stop_event.is_set():
|
||||
# Check if auto-update is enabled
|
||||
# Read current config values (so changes take effect)
|
||||
auto_enabled = self.store.get_config("auto_update_enabled", "false")
|
||||
interval_hours = float(self.store.get_config("check_interval_hours", "24"))
|
||||
|
||||
if auto_enabled.lower() == "true":
|
||||
# Run the check
|
||||
@@ -124,13 +125,11 @@ class UpdateScheduler:
|
||||
# Process any pending auto-updates
|
||||
self._loop.run_until_complete(self._download_pending_updates())
|
||||
|
||||
# Calculate next check time
|
||||
self._state.next_check = datetime.now() + timedelta(
|
||||
hours=self.check_interval_hours
|
||||
)
|
||||
# Calculate next check time using config value
|
||||
self._state.next_check = datetime.now() + timedelta(hours=interval_hours)
|
||||
|
||||
# Wait for interval or stop signal
|
||||
interval_seconds = self.check_interval_hours * 3600
|
||||
interval_seconds = interval_hours * 3600
|
||||
self._stop_event.wait(timeout=interval_seconds)
|
||||
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user