Merge pull request #1010 from bbassie/feature/plugin-browser

Plugin management through web interface
This commit is contained in:
Bastiaan authored and GitHub committed 2026-10-27 21:32:51 +00:00
1 parent e36a76acc5
commit ffe82f81d8
48 files changed
+4275 -536

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
/**
* Run a task now and again intervalMs after each run finishes, so runs never overlap.
* setInterval can't be used as an async task may take longer than the interval.
* The task handles its own errors.
*
* @returns Function that stops polling, a run in progress still finishes
*/
export function poll(task: () => Promise<void>, intervalMs: number) {
let stopped = false;
let timeout: ReturnType<typeof setTimeout> | undefined;
async function run() {
if (stopped) {
return;
}
await task();
// Stopping while the task ran must not schedule another run
if (!stopped) {
timeout = setTimeout(run, intervalMs);
}
}
run();
return () => {
stopped = true;
clearTimeout(timeout);
};
}