mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-15 11:57:59 +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")
|
SortMethodString := c.Request.URL.Query().Get("sort")
|
||||||
|
|
||||||
collection := context.CollectionFactory().SnapshotCollection()
|
collection := context.CollectionFactory().SnapshotCollection()
|
||||||
collection.Sort(SortMethodString)
|
collection.RLock()
|
||||||
|
defer collection.RUnlock()
|
||||||
|
|
||||||
|
if SortMethodString != "" {
|
||||||
|
collection.Sort(SortMethodString)
|
||||||
|
}
|
||||||
|
|
||||||
result := []*deb.Snapshot{}
|
result := []*deb.Snapshot{}
|
||||||
collection.ForEach(func(snapshot *deb.Snapshot) error {
|
collection.ForEach(func(snapshot *deb.Snapshot) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user