Skip to content

Commit

Permalink
smarter ping
Browse files Browse the repository at this point in the history
  • Loading branch information
TeddyRoncin committed May 16, 2024
1 parent 61c4619 commit 9548033
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions web/.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ API_KEY=test
BORROW_TIMEOUT=300
DISCORD_WEBHOOK_URL=
CHEST_ALWAYS_ALIVE=false
PINGS_MISSED_BEFORE_CHEST_DEATH=2
MAXIMAL_LATENCY_FOR_PING=30
2 changes: 1 addition & 1 deletion web/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function checkChestAlive() {
export function setLastTimeChestWasAlive(time: number, sendInSecs?: number) {
lastTimeChestWasAlive = time;
sendInterval =
((sendInSecs || Number.parseInt(process.env.TIME_BEFORE_CHEST_DEATH)) + 2) *
((sendInSecs || Number.parseInt(process.env.TIME_BEFORE_CHEST_DEATH)) * Number.parseInt(process.env.PINGS_MISSED_BEFORE_CHEST_DEATH) + Number.parseInt(process.env.MAXIMAL_LATENCY_FOR_PING)) *
1000;
checkChestAlive();
setTimeout(checkChestAlive, sendInterval);
Expand Down

0 comments on commit 9548033

Please sign in to comment.