feat: add nestjs replacement, remove nestjs (#285)

* feat: add nestjs replacement, remove nestjs

* fix: format issues

* fix: dependency issues

* fix: dependency issues

* fix: format issue

* fix: wrong channel used for logging channel
This commit is contained in:
Meier Lukas
2024-04-04 18:31:40 +02:00
committed by GitHub
parent c82915c6dc
commit 1936596c04
38 changed files with 599 additions and 2197 deletions

View File

@@ -0,0 +1,20 @@
import { queueChannel } from "@homarr/redis";
import { queueRegistry } from "~/queues";
/**
* This function reads all the queue executions that are due and processes them.
* Those executions are stored in the redis queue channel.
*/
export const queueWorker = async () => {
const now = new Date();
const executions = await queueChannel.filter((item) => {
return item.executionDate < now;
});
for (const execution of executions) {
const queue = queueRegistry.get(execution.name);
if (!queue) continue;
await queue.callback(execution.data);
await queueChannel.markAsDone(execution._id);
}
};