-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move bigint conversion * moving watch services into own module. adding watch fulfill intent service * creating watch fulfillment event * refactoring watch create intent to use same abstract parent * adding tests for watch fulfillment adding inbox processor adding intent utils method for update - > needs more work and tests * adding default intervals, intentconfigs, and liquiditymanager to config defaults.ts removing eventemitter from app modules adding interval modeule and service adding interval processor and queue adding retry_intent to source intent queue * adding skeleton of retry infeasable * disabling storage prover from being accepted by solver * updating routes-ts to ~0.2.10-beta update only on patch * fixing merge * adding retry infeasable intents tests
- Loading branch information
Showing
39 changed files
with
1,216 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { OnWorkerEvent, Processor, WorkerHost } from '@nestjs/bullmq' | ||
import { QUEUES } from '@/common/redis/constants' | ||
import { Injectable, Logger } from '@nestjs/common' | ||
import { Job } from 'bullmq' | ||
import { EcoLogMessage } from '@/common/logging/eco-log-message' | ||
import { UtilsIntentService } from '@/intent/utils-intent.service' | ||
import { FulfillmentLog } from '@/contracts/inbox' | ||
|
||
@Injectable() | ||
@Processor(QUEUES.INBOX.queue) | ||
export class InboxProcessor extends WorkerHost { | ||
private logger = new Logger(InboxProcessor.name) | ||
constructor(private readonly utilsIntentService: UtilsIntentService) { | ||
super() | ||
} | ||
|
||
async process( | ||
job: Job<any, any, string>, | ||
processToken?: string | undefined, // eslint-disable-line @typescript-eslint/no-unused-vars | ||
): Promise<any> { | ||
this.logger.debug( | ||
EcoLogMessage.fromDefault({ | ||
message: `InboxProcessor: process`, | ||
properties: { | ||
job: job.name, | ||
}, | ||
}), | ||
) | ||
|
||
switch (job.name) { | ||
case QUEUES.INBOX.jobs.fulfillment: | ||
return await this.utilsIntentService.updateOnFulfillment(job.data as FulfillmentLog) | ||
default: | ||
this.logger.error( | ||
EcoLogMessage.fromDefault({ | ||
message: `InboxProcessor: Invalid job type ${job.name}`, | ||
}), | ||
) | ||
return Promise.reject('Invalid job type') | ||
} | ||
} | ||
|
||
@OnWorkerEvent('failed') | ||
onJobFailed(job: Job<any, any, string>, error: Error) { | ||
this.logger.error( | ||
EcoLogMessage.fromDefault({ | ||
message: `InboxProcessor: Error processing job`, | ||
properties: { | ||
job, | ||
error, | ||
}, | ||
}), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { OnWorkerEvent, Processor, WorkerHost } from '@nestjs/bullmq' | ||
import { QUEUES } from '@/common/redis/constants' | ||
import { Injectable, Logger } from '@nestjs/common' | ||
import { Job } from 'bullmq' | ||
import { EcoLogMessage } from '@/common/logging/eco-log-message' | ||
import { RetryInfeasableIntentsService } from '@/intervals/retry-infeasable-intents.service' | ||
|
||
@Injectable() | ||
@Processor(QUEUES.INTERVAL.queue) | ||
export class IntervalProcessor extends WorkerHost { | ||
private logger = new Logger(IntervalProcessor.name) | ||
constructor(private readonly retryInfeasableIntentsService: RetryInfeasableIntentsService) { | ||
super() | ||
} | ||
|
||
async process( | ||
job: Job<any, any, string>, | ||
processToken?: string | undefined, // eslint-disable-line @typescript-eslint/no-unused-vars | ||
): Promise<any> { | ||
this.logger.debug( | ||
EcoLogMessage.fromDefault({ | ||
message: `IntervalProcessor: process`, | ||
properties: { | ||
job: job.name, | ||
}, | ||
}), | ||
) | ||
|
||
switch (job.name) { | ||
case QUEUES.INTERVAL.jobs.retry_infeasable_intents: | ||
return await this.retryInfeasableIntentsService.retryInfeasableIntents() | ||
default: | ||
this.logger.error( | ||
EcoLogMessage.fromDefault({ | ||
message: `IntervalProcessor: Invalid job type ${job.name}`, | ||
}), | ||
) | ||
return Promise.reject('Invalid job type') | ||
} | ||
} | ||
|
||
@OnWorkerEvent('failed') | ||
onJobFailed(job: Job<any, any, string>, error: Error) { | ||
this.logger.error( | ||
EcoLogMessage.fromDefault({ | ||
message: `IntervalProcessor: Error processing job`, | ||
properties: { | ||
job, | ||
error, | ||
}, | ||
}), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { InboxAbi } from '@eco-foundation/routes-ts' | ||
import { ExtractAbiEvent } from 'abitype' | ||
import { Prettify, Log } from 'viem' | ||
|
||
// Define the type for the Fulfillment event log | ||
export type FulfillmentLog = Prettify< | ||
Log<bigint, number, false, ExtractAbiEvent<typeof InboxAbi, 'Fulfillment'>, true> | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.