mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Lock snapshot collection before sorting
This commit is contained in:
+6
-1
@@ -13,7 +13,12 @@ func apiSnapshotsList(c *gin.Context) {
|
||||
SortMethodString := c.Request.URL.Query().Get("sort")
|
||||
|
||||
collection := context.CollectionFactory().SnapshotCollection()
|
||||
collection.Sort(SortMethodString)
|
||||
collection.RLock()
|
||||
defer collection.RUnlock()
|
||||
|
||||
if SortMethodString != "" {
|
||||
collection.Sort(SortMethodString)
|
||||
}
|
||||
|
||||
result := []*deb.Snapshot{}
|
||||
collection.ForEach(func(snapshot *deb.Snapshot) error {
|
||||
|
||||
Reference in New Issue
Block a user