add retry & clear log

master
cyhhao 2 years ago
parent 6872268e76
commit 40aa926fea

@ -98,7 +98,7 @@ class Git {
GitUtils.writeObject("tree", Buffer.from(""))
}
if (!GitUtils.historyExists(oid)) {
log("missing part of history from", oid)
// log("missing part of history from", oid)
for (let sha of GitUtils.referencedObjects(oid)) {
fetching.push(this.fetch(sha))
}

@ -75,14 +75,18 @@ async function eventIterator(
while (true) {
if (stop && stop()) break
let lastBlock = await Retrier(async () => await provider.getBlockNumber(), { maxRetry: 10 })
let lastBlock = await Retrier(async () => await provider.getBlockNumber(), {
maxRetry: 20,
retryInterval: 1000,
})
for (let i = last; i < lastBlock; i += RANGE) {
let end = i + RANGE - 1
if (end >= lastBlock) end = lastBlock - 1
console.log(i, end)
for (const filter of filters) {
let events = await Retrier(async () => await contract.queryFilter(filter, i, end), {
maxRetry: 10,
maxRetry: 20,
retryInterval: 1000,
})
for (const event of events) {
await eventCallback(event)

Loading…
Cancel
Save