Skip to content

Commit

Permalink
log emit timing
Browse files Browse the repository at this point in the history
  • Loading branch information
cauta committed May 13, 2024
1 parent eafe949 commit 8186e2f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
14 changes: 10 additions & 4 deletions app/apps/worker-service/src/worker/ethereum.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ export class EthereumWorker {
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
],
});

const emitStart = Date.now();
// handle native transfer
await this.emitNativeTransaction(block, false);
// handle extracted event for erc20 and nft
await this.emitLog(logs, false);
const emitEnd = Date.now();
//only update last sync for confirm
await this.saveBlockHistory(blockNumber, false);
this.logger.log(
`DETECT Scanning block ${blockNumber} in ${Date.now() - start}ms`,
`DETECT Scanning block ${blockNumber} in ${
Date.now() - start
}ms and emit ${emitEnd - emitStart}ms`,
);
} catch (error) {
this.logger.error([
Expand Down Expand Up @@ -100,14 +103,17 @@ export class EthereumWorker {
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
],
});
const emitStart = Date.now();
// handle native transfer
await this.emitNativeTransaction(block, true);
// handle extracted event for erc20 and nft
await this.emitLog(logs, true);

const emitEnd = Date.now();
await this.saveBlockHistory(blockNumber, true);
this.logger.log(
`CONFIRM Scanning block ${blockNumber} in ${Date.now() - start}ms`,
`CONFIRM Scanning block ${blockNumber} in ${
Date.now() - start
}ms and emit ${emitEnd - emitStart}ms`,
);
} catch (error) {
this.logger.error([
Expand Down
13 changes: 10 additions & 3 deletions app/apps/worker-service/src/worker/polygon.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,18 @@ export class PolygonWorker {
],
});

const emitStart = Date.now();
// handle native transfer
await this.emitNativeTransaction(block, false);
// handle extracted event for erc20 and nft
await this.emitLog(logs, false);
const emitEnd = Date.now();
//only update last sync for confirm
await this.saveBlockHistory(blockNumber, false);
this.logger.log(
`DETECT Scanning block ${blockNumber} in ${Date.now() - start}ms`,
`DETECT Scanning block ${blockNumber} in ${
Date.now() - start
}ms with emit ${emitEnd - emitStart}ms`,
);
} catch (error) {
this.logger.error([
Expand Down Expand Up @@ -99,14 +103,17 @@ export class PolygonWorker {
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
],
});
const emitStart = Date.now();
// handle native transfer
await this.emitNativeTransaction(block, true);
// handle extracted event for erc20 and nft
await this.emitLog(logs, true);

const emitEnd = Date.now();
await this.saveBlockHistory(blockNumber, true);
this.logger.log(
`CONFIRM Scanning block ${blockNumber} in ${Date.now() - start}ms`,
`CONFIRM Scanning block ${blockNumber} in ${
Date.now() - start
}ms with emit ${emitEnd - emitStart}ms`,
);
} catch (error) {
this.logger.error([
Expand Down

0 comments on commit 8186e2f

Please sign in to comment.