mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-09 13:35:19 +00:00
Enhance schedule initialization and management features
- Introduced a new `initSchedules` function to initialize and schedule active schedules from the database, improving the management of scheduled tasks. - Updated the `createSchedule` and `updateSchedule` functions to handle scheduling jobs based on the enabled status of schedules, ensuring proper job management. - Refactored the `removeScheduleJob` utility to cancel existing scheduled jobs, enhancing the flexibility of schedule updates. - Improved the `HandleSchedules` and `ShowSchedules` components by removing unused imports and enhancing the user interface for better clarity and usability.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { Schedule } from "@dokploy/server/db/schema/schedule";
|
||||
import { findScheduleById } from "@dokploy/server/services/schedule";
|
||||
import { scheduleJob as scheduleJobNode } from "node-schedule";
|
||||
import { scheduledJobs, scheduleJob as scheduleJobNode } from "node-schedule";
|
||||
import { getComposeContainer, getServiceContainerIV2 } from "../docker/utils";
|
||||
import { execAsyncRemote } from "../process/execAsync";
|
||||
import { spawnAsync } from "../process/spawnAsync";
|
||||
@@ -18,6 +18,11 @@ export const scheduleJob = (schedule: Schedule) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const removeScheduleJob = (scheduleId: string) => {
|
||||
const currentJob = scheduledJobs[scheduleId];
|
||||
currentJob?.cancel();
|
||||
};
|
||||
|
||||
export const runCommand = async (scheduleId: string) => {
|
||||
const {
|
||||
application,
|
||||
|
||||
Reference in New Issue
Block a user