2022-04-09 09:46:07 +02:00
|
|
|
module cron
|
|
|
|
|
|
|
|
import git
|
2022-04-10 16:17:50 +02:00
|
|
|
import datatypes
|
|
|
|
import time
|
|
|
|
|
|
|
|
struct ScheduledBuild {
|
|
|
|
repo git.GitRepo
|
|
|
|
timestamp time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
fn (r1 ScheduledBuild) < (r2 ScheduledBuild) bool {
|
|
|
|
return r1.timestamp < r2.timestamp
|
|
|
|
}
|
2022-04-09 09:46:07 +02:00
|
|
|
|
|
|
|
pub fn cron(conf Config) ? {
|
2022-04-10 16:17:50 +02:00
|
|
|
// mut queue := datatypes.MinHeap<ScheduledBuild>{}
|
|
|
|
// repos_map := git.get_repos(conf.address, conf.api_key) ?
|
|
|
|
|
|
|
|
// for _, repo in repos_map {
|
|
|
|
// scheduled := ScheduledBuild{
|
|
|
|
// repo: repo
|
|
|
|
// timestamp: 25
|
|
|
|
// }
|
|
|
|
|
|
|
|
// queue.insert(scheduled)
|
|
|
|
// }
|
|
|
|
|
|
|
|
// println(queue)
|
|
|
|
exp := "10/2 5 *"
|
|
|
|
println(parse_expression(exp) ?)
|
2022-04-09 09:46:07 +02:00
|
|
|
}
|