mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-07 09:19:41 -06:00
fix: serial-registration (#1574)
* fix: serial-registration * fix case * release ver
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hatchet-dev/typescript-sdk",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"description": "Background task orchestration & visibility for developers",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
|
||||
@@ -87,29 +87,25 @@ export class Worker {
|
||||
* @returns Array of registered workflow promises
|
||||
*/
|
||||
async registerWorkflows(workflows?: Array<BaseWorkflowDeclaration<any, any> | V0Workflow>) {
|
||||
return Promise.all(
|
||||
workflows?.map(async (wf) => {
|
||||
if (wf instanceof BaseWorkflowDeclaration) {
|
||||
// TODO check if tenant is V1
|
||||
const register = this.nonDurable.registerWorkflowV1(wf);
|
||||
for (const wf of workflows || []) {
|
||||
if (wf instanceof BaseWorkflowDeclaration) {
|
||||
// TODO check if tenant is V1
|
||||
await this.nonDurable.registerWorkflowV1(wf);
|
||||
|
||||
if (wf.definition._durableTasks.length > 0) {
|
||||
if (!this.durable) {
|
||||
this.durable = await this._v0.worker(`${this.name}-durable`, {
|
||||
...this.config,
|
||||
maxRuns: this.config.durableSlots || DEFAULT_DURABLE_SLOTS,
|
||||
});
|
||||
}
|
||||
this.durable.registerDurableActionsV1(wf.definition);
|
||||
if (wf.definition._durableTasks.length > 0) {
|
||||
if (!this.durable) {
|
||||
this.durable = await this._v0.worker(`${this.name}-durable`, {
|
||||
...this.config,
|
||||
maxRuns: this.config.durableSlots || DEFAULT_DURABLE_SLOTS,
|
||||
});
|
||||
}
|
||||
|
||||
return register;
|
||||
this.durable.registerDurableActionsV1(wf.definition);
|
||||
}
|
||||
|
||||
} else {
|
||||
// fallback to v0 client for backwards compatibility
|
||||
return this.nonDurable.registerWorkflow(wf);
|
||||
}) || []
|
||||
);
|
||||
await this.nonDurable.registerWorkflow(wf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user