Skip to content

Commit

Permalink
fix(backend/local): fix enqueue passing wrapped fn name to `functionI…
Browse files Browse the repository at this point in the history
…dMapping.set()` (#120)

* fix(backend/local): fix enqueue passing wrapped fn name to `functionIdMapping.set()`

* chore: changeset
  • Loading branch information
charlypoly authored Feb 7, 2024
1 parent 85a88d1 commit c1f4ffe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-candles-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@defer/client": minor
---

Fix local concurrency applied globally
6 changes: 3 additions & 3 deletions src/backend/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,18 @@ export async function enqueue<F extends DeferableFunction>(
discardAfter: Date | undefined,
metadata: { [key: string]: string } | undefined,
): Promise<EnqueueResult> {
let functionId = functionIdMapping.get(func.name);
let functionId = functionIdMapping.get(func.__metadata.name);
if (functionId === undefined) {
functionId = randomUUID();
functionIdMapping.set(func.name, functionId);
functionIdMapping.set(func.__metadata.name, functionId);
}

const now = new Date();
const execution: InternalExecution = {
id: randomUUID(),
state: "created",
functionId: functionId,
functionName: func.__fn.name,
functionName: func.__metadata.name,
func,
args: stringify(args),
metadata: metadata || {},
Expand Down

0 comments on commit c1f4ffe

Please sign in to comment.