lib/repo: Make locking timeout configurable

I want to make locking fully configurable (and probably off by default for now).
This is a prep commit for that.

Closes: #1375
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-12-13 14:20:30 -05:00 committed by Atomic Bot
parent bc3d80550b
commit a9a9445582
2 changed files with 9 additions and 3 deletions

View File

@ -37,8 +37,6 @@ G_BEGIN_DECLS
#define _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS 8
#define _OSTREE_MAX_OUTSTANDING_DELTAPART_REQUESTS 2
#define _OSTREE_DEFAULT_LOCK_TIMEOUT_SECONDS 30
/* In most cases, writing to disk should be much faster than
* fetching from the network, so we shouldn't actually hit
* this. But if using pipelining and e.g. pulling over LAN

View File

@ -1209,7 +1209,6 @@ ostree_repo_init (OstreeRepo *self)
self->objects_dir_fd = -1;
self->uncompressed_objects_dir_fd = -1;
self->sysroot_kind = OSTREE_REPO_SYSROOT_KIND_UNKNOWN;
self->lock_timeout_seconds = _OSTREE_DEFAULT_LOCK_TIMEOUT_SECONDS;
}
/**
@ -2734,6 +2733,15 @@ reload_core_config (OstreeRepo *self,
self->tmp_expiry_seconds = g_ascii_strtoull (tmp_expiry_seconds, NULL, 10);
}
{ g_autofree char *lock_timeout_seconds = NULL;
if (!ot_keyfile_get_value_with_default (self->config, "core", "lock-timeout-secs", "30",
&lock_timeout_seconds, error))
return FALSE;
self->lock_timeout_seconds = g_ascii_strtoull (lock_timeout_seconds, NULL, 10);
}
{ g_autofree char *compression_level_str = NULL;
/* gzip defaults to 6 */