Skip to content

Commit

Permalink
Fixed interval.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Aug 23, 2023
1 parent 449ba28 commit 2854e73
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/scripts/export/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ const main = async () => {
// server to start up.

// Wait for WebSocket to be ready.
setInterval(() => {
const interval = setInterval(() => {
if (webSocketConnected) {
clearInterval(interval)
resolve()
}
})
}, 1000)
})

// Connect to local RPC WebSocket once ready. Don't await since we need to
Expand All @@ -128,8 +129,6 @@ const main = async () => {
const latestBlockHeight = Number(height)
const latestBlockTimeUnixMs = Date.parse(time)

console.log('New block', latestBlockHeight)

// Cache block time for block height in cache used by state.
blockHeightToTimeCache.set(latestBlockHeight, latestBlockTimeUnixMs)

Expand Down Expand Up @@ -190,7 +189,7 @@ const main = async () => {
const tracedEvent = message.event

// Handle event after previous event is handled.
queueHandler = (queueHandler || Promise.resolve()).then(async () => {
queueHandler = queueHandler.then(async () => {
// Try to handle with each module, and stop once handled.
for (const { name, handler } of handlers) {
try {
Expand Down

0 comments on commit 2854e73

Please sign in to comment.