defer-run / defer.client

Zero infrastructure Node.js background jobs

Home Page:https://www.defer.run/docs/introduction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Concurrency option ignored in local dev

daguej opened this issue · comments

The defer client ignores the concurrency setting when executing jobs locally, and instead immediately invokes the handler function unconditionally, regardless of how many other invocations of the handler are already running.

defer.client/src/index.ts

Lines 104 to 109 in 301f78e

debug(`[defer.run][${originalFunction.name}] defer ignore, no token found.`);
const id = randomUUID();
__database.set(id, { id: id, state: "started" });
execLocally(id, originalFunction, functionArguments);
return { id };

Proper concurrency control is critical to my use case, and it's impossible to develop and test my code if this option does not work.

It would not be hard for the client to maintain an in-memory queue in order to ensure that only concurrency invocations of a job run at a time in dev.

This missing functionality is also not documented anywhere in the local dev docs or concurrency option docs.

Fixed in the v2.0.0!