This commit is contained in:
2025-03-09 15:59:57 +01:00
parent fb9c9b8070
commit 09f388e2ff
5 changed files with 8 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env -S v -n -w -parallel-cc -enable-globals run
#!/usr/bin/env -S v -n -cg -w -parallel-cc -enable-globals run
// #!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import os

View File

@@ -49,7 +49,7 @@ pub mut:
// GitRepoConfig holds repository-specific configuration options.
pub struct GitRepoConfig {
pub mut:
remote_check_period int = 3600 * 24 * 3 // Seconds to wait between remote checks (0 = check every time), default 3 days
remote_check_period int = 3600 * 24 * 7 // Seconds to wait between remote checks (0 = check every time), default 7 days
}
// just some initialization mechanism

View File

@@ -83,7 +83,8 @@ pub fn (mut repo GitRepo) need_pull() !bool {
// Therefore we need to pull
return true
}
return error('Failed to check merge-base: ${err}')
return true
// return error('Failed to check merge-base: ${err}')
}
// If we get here, the remote commit is in our history
// Therefore we don't need to pull

View File

@@ -13,6 +13,9 @@ pub fn (mut repo GitRepo) status_update(args StatusUpdateArgs) ! {
// Check current time vs last check, if needed (check period) then load
repo.cache_get() or { return error('Failed to get cache for repo ${repo.name}: ${err}') } // Ensure we have the situation from redis
repo.init() or { return error('Failed to initialize repo ${repo.name}: ${err}') }
if 'OFFLINE' !in os.environ() {
return
}
current_time := int(time.now().unix())
if args.reload || repo.last_load == 0
|| current_time - repo.last_load >= repo.config.remote_check_period {

View File

@@ -30,7 +30,6 @@ fn obj_init(mycfg_ CaddyServer) !CaddyServer {
// user needs to us switch to make sure we get the right object
fn configure() ! {
mut cfg := get()!
if !os.exists('/etc/caddy/Caddyfile') {
// set the default caddyfile
configure_examples(path: cfg.path)!