mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-20 03:20:52 +00:00
Fix: Prevent ServerStorageCheckJob duplication when Sentinel is active
When Sentinel is enabled and in sync, ServerStorageCheckJob was being dispatched from two locations causing unnecessary duplication: 1. PushServerUpdateJob (every ~30s with real-time filesystem data) 2. ServerManagerJob (scheduled cron check via SSH) This commit modifies ServerManagerJob to only dispatch ServerStorageCheckJob when Sentinel is out of sync or disabled. When Sentinel is active and in sync, PushServerUpdateJob provides real-time storage data, making the scheduled SSH check redundant. Benefits: - Eliminates duplicate storage checks when Sentinel is working - Reduces unnecessary SSH overhead - Storage checks still run as fallback when Sentinel fails - Maintains scheduled checks for servers without Sentinel Updated tests to reflect new behavior: - Storage check NOT dispatched when Sentinel is in sync - Storage check dispatched when Sentinel is out of sync or disabled - All timezone and frequency tests updated accordingly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -139,15 +139,18 @@ class ServerManagerJob implements ShouldQueue
|
||||
});
|
||||
}
|
||||
|
||||
// Dispatch ServerStorageCheckJob if due (independent of Sentinel status)
|
||||
$serverDiskUsageCheckFrequency = data_get($server->settings, 'server_disk_usage_check_frequency', '0 23 * * *');
|
||||
if (isset(VALID_CRON_STRINGS[$serverDiskUsageCheckFrequency])) {
|
||||
$serverDiskUsageCheckFrequency = VALID_CRON_STRINGS[$serverDiskUsageCheckFrequency];
|
||||
}
|
||||
$shouldRunStorageCheck = $this->shouldRunNow($serverDiskUsageCheckFrequency, $serverTimezone);
|
||||
// Dispatch ServerStorageCheckJob if due (only when Sentinel is out of sync or disabled)
|
||||
// When Sentinel is active, PushServerUpdateJob handles storage checks with real-time data
|
||||
if ($sentinelOutOfSync) {
|
||||
$serverDiskUsageCheckFrequency = data_get($server->settings, 'server_disk_usage_check_frequency', '0 23 * * *');
|
||||
if (isset(VALID_CRON_STRINGS[$serverDiskUsageCheckFrequency])) {
|
||||
$serverDiskUsageCheckFrequency = VALID_CRON_STRINGS[$serverDiskUsageCheckFrequency];
|
||||
}
|
||||
$shouldRunStorageCheck = $this->shouldRunNow($serverDiskUsageCheckFrequency, $serverTimezone);
|
||||
|
||||
if ($shouldRunStorageCheck) {
|
||||
ServerStorageCheckJob::dispatch($server);
|
||||
if ($shouldRunStorageCheck) {
|
||||
ServerStorageCheckJob::dispatch($server);
|
||||
}
|
||||
}
|
||||
|
||||
// Dispatch ServerPatchCheckJob if due (weekly)
|
||||
|
||||
Reference in New Issue
Block a user