Skip to content

Commit

Permalink
fix: renderer unresponsive after some time
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteMinds committed Jul 30, 2023
1 parent 6d838fb commit 493e293
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/web/src/services/TabService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ function cleanLeaderInfo() {
let updateTenureTimer: number | null = null
function startElection() {
if (getLeaderInfo() != null) return
if (updateTenureTimer != null) return

const updateTenure = () =>
setLeaderInfo({
id,
expire: Date.now() + leaderHeartbeatTimeout,
})
updateTenure()

if (updateTenureTimer != null) return
updateTenureTimer = window.setInterval(updateTenure, leaderHeartbeatTimeout / 10)

updateTenure()
}

function quitElection() {
Expand Down

0 comments on commit 493e293

Please sign in to comment.