...
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user