fix: serialize local-agent heartbeats
This commit is contained in:
16
local-agent/serialized-runner.mjs
Normal file
16
local-agent/serialized-runner.mjs
Normal file
@@ -0,0 +1,16 @@
|
||||
export function createSerializedRunner(task) {
|
||||
let activePromise = null;
|
||||
|
||||
return function runSerialized(...args) {
|
||||
if (activePromise) {
|
||||
return activePromise;
|
||||
}
|
||||
|
||||
activePromise = Promise.resolve(task(...args))
|
||||
.finally(() => {
|
||||
activePromise = null;
|
||||
});
|
||||
|
||||
return activePromise;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user