Skip to content

Commit

Permalink
give backups a 30 minute timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Jan 9, 2021
1 parent 0bb34f3 commit ea2e8cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkgs/restic-backup/backup.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ class Backup
# Wait until we are synchronized...
# The way we measure this is unfortunately not ideal, but should be a
# good approximation if this runs continuously and without a huge delta.
#
# TODO: establish a source of truth (querying the passive node for its tip?)
def wait_for_tip
loop do
sleep 5
30.times do
sleep 1.minute

stats = NodeStats.from_json(HTTP::Client.get("http://127.0.0.1:9000/api/v0/node/stats").body)

Expand All @@ -58,6 +56,8 @@ class Backup
return
end
end

raise "Node was unable to synchronize within 30 minutes"
end

def backup
Expand Down

0 comments on commit ea2e8cb

Please sign in to comment.