fix: serialize local-agent heartbeats

This commit is contained in:
kris
2026-03-31 21:49:46 +08:00
parent 02fcc56332
commit be31503d22
3 changed files with 59 additions and 1 deletions

View 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;
};
}