Skip to content
Permalink
Browse files

Actually commit that

  • Loading branch information...
NobodyNada committed Feb 7, 2019
1 parent c0a5448 commit 341bbd9bd5a6921c08c7a5ed828f4adc784fb76b
Showing with 15 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +14 −1 Sources/Frontend/BackgroundTasks.swift
@@ -16,6 +16,7 @@ room_*_stackexchange.com.json
room_*_meta.stackexchange.com.json
reports.json
location.txt
/Packages

# Ignore swap files; I use vim.
*.sw[klmnop]
@@ -85,6 +85,9 @@ func handleInput(input: String, rooms: [ChatRoom], listener: ChatListener) {
)
}

let maxRedundaErrors = 3
var redundaErrorCount = 0


func scheduleBackgroundTasks(rooms: [ChatRoom], listener: ChatListener) {
BackgroundTaskManager.shared.tasks = [
@@ -163,11 +166,21 @@ func scheduleBackgroundTasks(rooms: [ChatRoom], listener: ChatListener) {
listener.stop(.reboot)
}

if redundaErrorCount >= maxRedundaErrors {
rooms.first!.postMessage("[ [\(botName)](\(githubLink)) ] Redunda appears to be back up (cc @NobodyNada).")
}
redundaErrorCount = 0

if let commit = ciVersion ?? updateVersion {
_ = update(to: commit, listener: listener, rooms: [rooms.first!])
}
} catch {
handleError(error, "while sending a status ping to Redunda")
redundaErrorCount += 1
if redundaErrorCount == maxRedundaErrors {
rooms.first!.postMessage("[ [\(botName)](\(githubLink)) ] Redunda appears to be down; silencing errors (cc @NobodyNada).")
} else if redundaErrorCount < maxRedundaErrors {
handleError(error, "while sending a status ping to Redunda")
}
}
}
]

0 comments on commit 341bbd9

Please sign in to comment.
You can’t perform that action at this time.