Skip to content

Commit

Permalink
log pause response
Browse files Browse the repository at this point in the history
  • Loading branch information
egasimus committed Nov 21, 2024
1 parent 5888184 commit c19f81a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions control_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@ function main () {
})
const service = new NamadaService(NAMADA, CHAIN_ID)
service.events.addEventListener('request-pause', async () => {
let result = true
while (!(result === false)) {
let canConnect = true
while (!(canConnect === false)) {
console.log('🟠 Requesting pause until indexer catches up.')
const response = await fetch(`${NODE_OUT}/pause`)
result = (await response.json()).canConnect
const responseJson = await response.json()
console.log('🟠 Pause response:', responseJson)
canConnect = (await response.json()).canConnect
await new Promise(resolve=>setTimeout(resolve, 100))
}
})
api('Node', HOST, PORT, service.routes(), {
onOpen: ({ send }) => {
onOpen: ({ send }) => {
service.events.addEventListener('synced', send)
},
onClose: ({ send }) => {
onClose: ({ send }) => {
service.events.removeEventListener('synced', send)
},
onMessage: async ({ event }) => {
Expand Down

0 comments on commit c19f81a

Please sign in to comment.