mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-07 16:34:06 +00:00
Implement reset job queue and state CLI in watchers (#276)
* Implement clean jobs CLI in watchers * Pull common code cleanJobs to util * Implement commands for reset job-queue and state * Reset command for job-queues and watcher state * Reset sync status on reset state * Fix using cli from built js * Implement skipCheck to reset syncStatus table and skip complete handler on fail * Check for block isComplete on reset state * Set default value for force param to update syncStatus to false * Reset tables in erc20 watcher * Push job in fill after previos block is complete
This commit is contained in:
@@ -70,15 +70,27 @@ export class EventWatcher {
|
||||
|
||||
async initBlockProcessingOnCompleteHandler (): Promise<void> {
|
||||
this._jobQueue.onComplete(QUEUE_BLOCK_PROCESSING, async (job) => {
|
||||
const { id, data: { failed } } = job;
|
||||
|
||||
if (failed) {
|
||||
log(`Job ${id} for queue ${QUEUE_BLOCK_PROCESSING} failed`);
|
||||
return;
|
||||
}
|
||||
|
||||
await this._baseEventWatcher.blockProcessingCompleteHandler(job);
|
||||
});
|
||||
}
|
||||
|
||||
async initEventProcessingOnCompleteHandler (): Promise<void> {
|
||||
await this._jobQueue.onComplete(QUEUE_EVENT_PROCESSING, async (job) => {
|
||||
const dbEvent = await this._baseEventWatcher.eventProcessingCompleteHandler(job);
|
||||
const { id, data: { request, failed, state, createdOn } } = job;
|
||||
|
||||
const { data: { request, failed, state, createdOn } } = job;
|
||||
if (failed) {
|
||||
log(`Job ${id} for queue ${QUEUE_EVENT_PROCESSING} failed`);
|
||||
return;
|
||||
}
|
||||
|
||||
const dbEvent = await this._baseEventWatcher.eventProcessingCompleteHandler(job);
|
||||
|
||||
const timeElapsedInSeconds = (Date.now() - Date.parse(createdOn)) / 1000;
|
||||
log(`Job onComplete event ${request.data.id} publish ${!!request.data.publish}`);
|
||||
|
||||
Reference in New Issue
Block a user