refactor: make cron.expression into cron module
This commit is contained in:
parent
dce00bfab6
commit
3f1aea13e2
15 changed files with 92 additions and 89 deletions
|
|
@ -3,12 +3,12 @@ module server
|
|||
import time
|
||||
import models { BuildLog }
|
||||
import os
|
||||
import cron.expression { CronExpression }
|
||||
import cron
|
||||
|
||||
const fallback_log_removal_frequency = 24 * time.hour
|
||||
|
||||
// log_removal_daemon removes old build logs every `log_removal_frequency`.
|
||||
fn (mut app App) log_removal_daemon(schedule CronExpression) {
|
||||
fn (mut app App) log_removal_daemon(schedule cron.Expression) {
|
||||
mut start_time := time.Time{}
|
||||
|
||||
for {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import repo
|
|||
import util
|
||||
import db
|
||||
import build { BuildJobQueue }
|
||||
import cron.expression
|
||||
import cron
|
||||
import metrics
|
||||
|
||||
const (
|
||||
|
|
@ -43,11 +43,11 @@ pub fn server(conf Config) ! {
|
|||
util.exit_with_message(1, "'any' is not allowed as the value for default_arch.")
|
||||
}
|
||||
|
||||
global_ce := expression.parse_expression(conf.global_schedule) or {
|
||||
global_ce := cron.parse_expression(conf.global_schedule) or {
|
||||
util.exit_with_message(1, 'Invalid global cron expression: $err.msg()')
|
||||
}
|
||||
|
||||
log_removal_ce := expression.parse_expression(conf.log_removal_schedule) or {
|
||||
log_removal_ce := cron.parse_expression(conf.log_removal_schedule) or {
|
||||
util.exit_with_message(1, 'Invalid log removal cron expression: $err.msg()')
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue