mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-10 00:15:28 +02:00
feat(schedules): add timezone support for scheduled jobs and update database schema
- Introduced a new `commonTimezones` array for timezone selection in the UI. - Updated the schedule form to include an optional timezone field. - Modified the database schema to add a `timezone` column to the `schedule` table. - Enhanced the scheduling logic to utilize the specified timezone, defaulting to UTC if not provided.
This commit is contained in:
@@ -14,11 +14,21 @@ import { execAsyncRemote } from "../process/execAsync";
|
||||
import { spawnAsync } from "../process/spawnAsync";
|
||||
|
||||
export const scheduleJob = (schedule: Schedule) => {
|
||||
const { cronExpression, scheduleId } = schedule;
|
||||
const { cronExpression, scheduleId, timezone } = schedule;
|
||||
|
||||
scheduleJobNode(scheduleId, cronExpression, async () => {
|
||||
await runCommand(scheduleId);
|
||||
});
|
||||
// Use timezone from schedule, default to UTC if not specified
|
||||
const tz = timezone || "UTC";
|
||||
|
||||
scheduleJobNode(
|
||||
scheduleId,
|
||||
{
|
||||
tz,
|
||||
rule: cronExpression,
|
||||
},
|
||||
async () => {
|
||||
await runCommand(scheduleId);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const removeScheduleJob = (scheduleId: string) => {
|
||||
|
||||
Reference in New Issue
Block a user