mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-09 21:16:48 +03:00
config
This commit is contained in:
@@ -204,16 +204,18 @@ export function mapDbScheduleToUi(dbSchedule: DbScheduleConfig): any {
|
|||||||
let intervalSeconds = 86400; // Default to daily (24 hours)
|
let intervalSeconds = 86400; // Default to daily (24 hours)
|
||||||
|
|
||||||
if (dbSchedule.interval) {
|
if (dbSchedule.interval) {
|
||||||
// Check if it's a cron expression
|
// Check if it's already a number (seconds), use it directly
|
||||||
const cronMatch = dbSchedule.interval.match(/0 \*\/(\d+) \* \* \*/);
|
if (typeof dbSchedule.interval === 'number') {
|
||||||
if (cronMatch) {
|
|
||||||
intervalSeconds = parseInt(cronMatch[1]) * 3600;
|
|
||||||
} else if (typeof dbSchedule.interval === 'number') {
|
|
||||||
// If it's already a number (seconds), use it directly
|
|
||||||
intervalSeconds = dbSchedule.interval;
|
intervalSeconds = dbSchedule.interval;
|
||||||
} else if (dbSchedule.interval === "0 2 * * *") {
|
} else if (typeof dbSchedule.interval === 'string') {
|
||||||
// Daily at 2 AM
|
// Check if it's a cron expression
|
||||||
intervalSeconds = 86400;
|
const cronMatch = dbSchedule.interval.match(/0 \*\/(\d+) \* \* \*/);
|
||||||
|
if (cronMatch) {
|
||||||
|
intervalSeconds = parseInt(cronMatch[1]) * 3600;
|
||||||
|
} else if (dbSchedule.interval === "0 2 * * *") {
|
||||||
|
// Daily at 2 AM
|
||||||
|
intervalSeconds = 86400;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user