From a3b1c7535a02c3c3aefd1a7d7d13652a3ba04988 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 1 Jun 2017 08:39:35 +0200 Subject: [PATCH] mediaapi/writers/download: Remove unnecesary Unlock, Lock after Cond.Wait --- .../matrix-org/dendrite/mediaapi/writers/download.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go b/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go index 35eca6b6..aecb1dd3 100644 --- a/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go +++ b/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go @@ -253,10 +253,8 @@ func (r *downloadRequest) getMediaMetadataForRemoteFile(db *storage.Database, ac if activeRemoteRequestResult, ok := activeRemoteRequests.MXCToResult[mxcURL]; ok { r.Logger.Info("Waiting for another goroutine to fetch the remote file.") + // NOTE: Wait unlocks and locks again internally. There is still a deferred Unlock() that will unlock this. activeRemoteRequestResult.Cond.Wait() - activeRemoteRequests.Unlock() - // NOTE: there is still a deferred Unlock() that will unlock this - activeRemoteRequests.Lock() // check if we have a record of the media in our database mediaMetadata, err := db.GetMediaMetadata(r.MediaMetadata.MediaID, r.MediaMetadata.Origin)