Add missing BackupMonitor methods for health check endpoints
- Add get_recent_backups method to return recent backup history - Add get_failed_backups method to return failed backup history - Add get_container_backup_history method for container-specific history - All methods are thread-safe with mutex synchronization - Methods return data in reverse chronological order (newest first) This fixes the 'undefined method get_recent_backups' error in health endpoints.
This commit is contained in:
parent
a68196431f
commit
6688145ff2
1 changed files with 23 additions and 0 deletions
|
@ -230,4 +230,27 @@ class Baktainer::BackupMonitor
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get recent backups for health check endpoints
|
||||||
|
def get_recent_backups(limit = 50)
|
||||||
|
@mutex.synchronize do
|
||||||
|
@backup_history.last(limit).reverse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get failed backups for health check endpoints
|
||||||
|
def get_failed_backups(limit = 20)
|
||||||
|
@mutex.synchronize do
|
||||||
|
failed = @backup_history.select { |b| b[:status] == 'failed' }
|
||||||
|
failed.last(limit).reverse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get backup history for a specific container
|
||||||
|
def get_container_backup_history(container_name, limit = 20)
|
||||||
|
@mutex.synchronize do
|
||||||
|
container_backups = @backup_history.select { |b| b[:container_name] == container_name }
|
||||||
|
container_backups.last(limit).reverse
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Add table
Reference in a new issue