fix(analytics): restrict publishing to every week (#5028)

This commit is contained in:
Meier Lukas authored and GitHub committed 2026-02-20 17:44:02 +01:00
1 parent 24560cb93f
commit 8c4be2fbe8
5 files changed
+34 -10

No files matched your search

+12 -1
View File
@@ -31,6 +31,10 @@ export class JobManager implements IJobManager {
if (!validateCron(cron)) {
throw new Error(`Invalid cron expression: ${cron}`);
}
if (job.preventCustomInterval && cron !== job.cronExpression) {
throw new Error(`Custom cron expressions are not allowed for job ${name}`);
}
await this.updateConfigurationAsync(name, { cronExpression: cron });
await this.jobGroup.getTask(name)?.destroy();
@@ -100,7 +104,13 @@ export class JobManager implements IJobManager {
}
public async getAllAsync(): Promise<
{ name: JobGroupKeys; cron: string; preventManualExecution: boolean; isEnabled: boolean }[]
{
name: JobGroupKeys;
cron: string;
preventManualExecution: boolean;
preventCustomInterval: boolean;
isEnabled: boolean;
}[]
> {
const configurations = await this.db.query.cronJobConfigurations.findMany();
@@ -110,6 +120,7 @@ export class JobManager implements IJobManager {
name,
cron: config?.cronExpression ?? job.cronExpression,
preventManualExecution: job.preventManualExecution,
preventCustomInterval: job.preventCustomInterval,
isEnabled: config?.isEnabled ?? true,
};
});