Skip to content

Commit

Permalink
Pass workflow id into SchemaManager when using it inside workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pilsy committed Sep 12, 2024
1 parent 34f8fe4 commit 71ac039
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/SchemaManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export class SchemaManager extends EventEmitter {
* Returns the singleton instance of SchemaManager.
* @returns The SchemaManager instance.
*/
public static getInstance(): SchemaManager {
public static getInstance(workflowId?: string): SchemaManager {
if (!this.instance) {
this.instance = new SchemaManager();
this.instance = new SchemaManager(workflowId);
}
return this.instance;
}
Expand All @@ -66,7 +66,7 @@ export class SchemaManager extends EventEmitter {
/**
* Private constructor to enforce singleton pattern.
*/
private constructor() {
private constructor(protected workflowId?: string) {
super();
}

Expand Down
2 changes: 1 addition & 1 deletion src/workflows/StatefulWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export type PendingChange = {
};

export abstract class StatefulWorkflow extends Workflow {
private schemaManager = SchemaManager.getInstance();
private schemaManager = SchemaManager.getInstance(workflow.workflowInfo().workflowId);
private schema: Schema;

protected async condition(): Promise<any> {
Expand Down

0 comments on commit 71ac039

Please sign in to comment.