another fix for human choices
This commit is contained in:
@@ -123,9 +123,15 @@ function handleKeyboard(e: KeyboardEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
let pollBackoff = 0
|
||||
|
||||
function startPolling() {
|
||||
pollBackoff = 0
|
||||
pollForChallenge()
|
||||
pollHandle = setInterval(pollForChallenge, 600)
|
||||
pollHandle = setInterval(() => {
|
||||
if (pollBackoff > 0) { pollBackoff--; return }
|
||||
pollForChallenge()
|
||||
}, 800)
|
||||
}
|
||||
|
||||
function stopPolling() {
|
||||
@@ -172,7 +178,9 @@ async function pollForChallenge() {
|
||||
|
||||
try {
|
||||
const res = await fetch(`/api/fights/${fightId.value}/challenge/${myBotId.value}`)
|
||||
if (res.status === 429) { pollBackoff = Math.min(pollBackoff + 2, 8); return }
|
||||
if (!res.ok) return
|
||||
pollBackoff = Math.max(0, pollBackoff - 1)
|
||||
const data = await res.json()
|
||||
|
||||
// Reset error tracking on success
|
||||
|
||||
Reference in New Issue
Block a user