-
Notifications
You must be signed in to change notification settings - Fork 15
Add sequencer id to job payloads #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
a66aac1
d5898a0
829f174
e80d0fb
ddf7607
19c7716
045455f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,4 @@ | |
| "remove-nested-blocks": "off", | ||
| "apply-shorthand-properties": "off" | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,11 +17,13 @@ import { | |
| ProtocolModulesRecord, | ||
| } from "@proto-kit/protocol"; | ||
| import { injectable } from "tsyringe"; | ||
| import { Field } from "o1js"; | ||
|
|
||
| import { SequencerModule } from "../builder/SequencerModule"; | ||
| import { Closeable } from "../builder/Closeable"; | ||
| import { ConsoleTracingFactory } from "../../logging/ConsoleTracingFactory"; | ||
| import { StartableModule } from "../builder/StartableModule"; | ||
| import { TaskQueue } from "../../worker/queue/TaskQueue"; | ||
|
|
||
| import { Sequenceable } from "./Sequenceable"; | ||
|
|
||
|
|
@@ -34,6 +36,13 @@ export class Sequencer<Modules extends SequencerModulesRecord> | |
| extends ModuleContainer<Modules> | ||
| implements Sequenceable | ||
| { | ||
| public readonly id: string; | ||
|
|
||
| public constructor(definition: Modules) { | ||
| super(definition); | ||
| this.id = Field.random().toString(); | ||
| } | ||
|
|
||
| /** | ||
| * Alternative constructor for Sequencer | ||
| * @param definition | ||
|
|
@@ -81,6 +90,12 @@ export class Sequencer<Modules extends SequencerModulesRecord> | |
|
|
||
| this.useDependencyFactory(MethodIdFactory); | ||
|
|
||
| // Drain all task queues to clear stale tasks from previous sequencer instances | ||
| if (this.container.isRegistered("TaskQueue")) { | ||
| const taskQueue = this.container.resolve<TaskQueue>("TaskQueue"); | ||
|
||
| await taskQueue.drainAllQueues(); | ||
| } | ||
|
|
||
| // Log startup info | ||
| const moduleClassNames = Object.values(this.definition).map( | ||
| (clazz) => clazz.name | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,4 +20,5 @@ export interface TaskPayload { | |
| payload: string; | ||
| taskId?: string; | ||
| flowId: string; | ||
| sequencerId: string; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.