Skip to content

Commit ebd591c

Browse files
authored
Merge pull request #34 from ora-io/dev
feat(reku): add debug logs
2 parents ce3bbb5 + a012db6 commit ebd591c

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ora-stack",
3-
"version": "0.3.4",
3+
"version": "0.3.5",
44
"private": true,
55
"packageManager": "[email protected]",
66
"description": "",

packages/orap/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ora-io/orap",
33
"type": "module",
4-
"version": "0.3.4",
4+
"version": "0.3.5",
55
"packageManager": "[email protected]",
66
"description": "",
77
"author": "Norman (nom4dv3), MuRong",

packages/reku/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ora-io/reku",
33
"type": "module",
4-
"version": "0.3.5",
4+
"version": "0.3.7",
55
"packageManager": "[email protected]",
66
"description": "",
77
"author": "Norman (nom4dv3), MuRong",

packages/reku/src/event/crosschecker/autochecker.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export class AutoCrossChecker extends BaseCrossChecker {
9292

9393
const waitNextCrosscheck = async (): Promise<boolean> => {
9494
latestBlockNum = await timeoutWithRetry(() => {
95+
// console.log(this.provider, this.provider.provider)
9596
if (!this.provider || !this.provider.provider)
9697
throw new Error('provider not ready')
9798
return this.provider.provider?.getBlockNumber()
@@ -143,19 +144,27 @@ export class AutoCrossChecker extends BaseCrossChecker {
143144

144145
// TODO: replace polling with schedule cron
145146
await polling(async () => {
146-
const wait = await waitOrUpdateToBlock()
147-
debug('polling interval: %d, wait: %s, from block: %d, to block: %d', pollingInterval, wait, ccrOptions.fromBlock, ccrOptions.toBlock)
148-
if (wait) {
149-
await this.crossCheckRange(ccrOptions)
150-
// only update options after cc succ
151-
await updateCCROptions(ccrOptions)
147+
try {
148+
debug('start polling')
149+
const wait = await waitOrUpdateToBlock()
150+
debug('polling interval: %d, wait: %s, from block: %d, to block: %d', pollingInterval, wait, ccrOptions.fromBlock, ccrOptions.toBlock)
151+
if (wait) {
152+
await this.crossCheckRange(ccrOptions)
153+
// only update options after cc succ
154+
await updateCCROptions(ccrOptions)
155+
}
156+
else {
157+
debug('Because the latest block %d is too old, skip this cross check', latestBlockNum)
158+
}
159+
debug('end condition')
160+
const end = endingCondition()
161+
debug('polling ending condition: %s', end)
162+
return end
152163
}
153-
else {
154-
debug('Because the latest block %d is too old, skip this cross check', latestBlockNum)
164+
catch (error) {
165+
debug('polling error', error)
166+
return false
155167
}
156-
const end = endingCondition()
157-
debug('polling ending condition: %s', end)
158-
return end
159168
}, pollingInterval)
160169
}
161170

0 commit comments

Comments
 (0)