cache: Implement --cache-db-wait-time flag

This can be used to make the cache wait for other running cache
backends to finish rather than erroring after 1 second.
This commit is contained in:
Nick Craig-Wood 2018-03-08 12:16:18 +00:00
parent 6025bb6ad1
commit a7dbf32c53
3 changed files with 14 additions and 1 deletions

View file

@ -122,7 +122,7 @@ func (b *Persistent) connect() error {
if err != nil {
return errors.Wrapf(err, "failed to create a data directory %q", b.dataPath)
}
b.db, err = bolt.Open(b.dbPath, 0644, &bolt.Options{Timeout: 1 * time.Second})
b.db, err = bolt.Open(b.dbPath, 0644, &bolt.Options{Timeout: *cacheDbWaitTime})
if err != nil {
return errors.Wrapf(err, "failed to open a cache connection to %q", b.dbPath)
}