mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-01 04:40:38 +00:00
Merge pull request #307 from vincentbernat/fix/defer-lock
Fix lock handling in cache flusher for API
This commit is contained in:
@@ -32,6 +32,7 @@ func cacheFlusher() {
|
|||||||
for {
|
for {
|
||||||
<-ticker
|
<-ticker
|
||||||
|
|
||||||
|
func() {
|
||||||
// lock everything to eliminate in-progress calls
|
// lock everything to eliminate in-progress calls
|
||||||
r := context.CollectionFactory().RemoteRepoCollection()
|
r := context.CollectionFactory().RemoteRepoCollection()
|
||||||
r.Lock()
|
r.Lock()
|
||||||
@@ -51,6 +52,7 @@ func cacheFlusher() {
|
|||||||
|
|
||||||
// all collections locked, flush them
|
// all collections locked, flush them
|
||||||
context.CollectionFactory().Flush()
|
context.CollectionFactory().Flush()
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user