Files
outline/server/queues/tasks/index.ts
Tom Moor 42959d66db chore: Add cron task partitioning (#10736)
* wip

* Implementation complete

* tidying

* test

* Address feedback

* Remove duplicative retry logic from UpdateDocumentsPopularityScoreTask.
Now that we're split across many runs this is not neccessary

* Refactor to subclass, config to instance

* Refactor BaseTask to named export

* fix: Missing partition

* tsc

* Feedback
2025-11-27 16:57:52 +01:00

21 lines
512 B
TypeScript

import { Hook, PluginManager } from "@server/utils/PluginManager";
import { requireDirectory } from "@server/utils/fs";
import { BaseTask } from "./base/BaseTask";
const tasks: Record<string, typeof BaseTask> = {};
requireDirectory<{ default: typeof BaseTask }>(__dirname).forEach(
([module, id]) => {
if (id === "index") {
return;
}
tasks[id] = module.default;
}
);
PluginManager.getHooks(Hook.Task).forEach((hook) => {
tasks[hook.value.name] = hook.value;
});
export default tasks;