Lock collections before building graph. #169

This commit is contained in:
Andrey Smirnov
2015-01-13 19:17:19 +03:00
parent 427c42f4b8
commit 67ce828eeb

View File

@@ -17,7 +17,18 @@ func apiGraph(c *gin.Context) {
output []byte
)
graph, err := deb.BuildGraph(context.CollectionFactory())
factory := context.CollectionFactory()
factory.RemoteRepoCollection().RLock()
defer factory.RemoteRepoCollection().RUnlock()
factory.LocalRepoCollection().RLock()
defer factory.LocalRepoCollection().RUnlock()
factory.SnapshotCollection().RLock()
defer factory.LocalRepoCollection().RUnlock()
factory.PublishedRepoCollection().RLock()
defer factory.PublishedRepoCollection().RUnlock()
graph, err := deb.BuildGraph(factory)
if err != nil {
c.JSON(500, err)
return