feat(build): start of server-side job queue

This commit is contained in:
Jef Roosens 2022-12-06 14:11:17 +01:00
parent 6281ef7607
commit 9a49d96e20
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
9 changed files with 174 additions and 28 deletions

View file

@ -20,6 +20,6 @@ pub fn agent(conf Config) ! {
logger.set_full_logpath(log_file)
logger.log_to_console_too()
mut d := agent.agent_init(logger, conf)
mut d := agent_init(logger, conf)
d.run()
}

View file

@ -5,15 +5,15 @@ import conf as vconf
struct Config {
pub:
log_level string = 'WARN'
api_key string
address string
data_dir string
max_concurrent_builds int = 1
polling_frequency int = 30
log_level string = 'WARN'
api_key string
address string
data_dir string
max_concurrent_builds int = 1
polling_frequency int = 30
// Architecture of agent
/* arch string */
/* image_rebuild_frequency int = 1440 */
// arch string
// image_rebuild_frequency int = 1440
}
// cmd returns the cli module that handles the cron daemon.

View file

@ -13,13 +13,13 @@ const (
struct AgentDaemon {
logger shared log.Log
conf Config
conf Config
// Which builds are currently running; length is same as
// conf.max_concurrent_builds
builds []BuildConfig
// Atomic variables used to detect when a build has finished; length is the
// same as conf.max_concurrent_builds
client client.Client
client client.Client
atomics []u64
}
@ -39,10 +39,8 @@ pub fn (mut d AgentDaemon) run() {
for {
free_builds := d.update_atomics()
if free_builds > 0 {
}
if free_builds > 0 {
}
}
}