mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-25 13:11:37 +00:00
mediaapi/writers/download: Remove unnecesary Unlock, Lock after Cond.Wait
This commit is contained in:
parent
923013aa55
commit
a3b1c7535a
@ -253,10 +253,8 @@ func (r *downloadRequest) getMediaMetadataForRemoteFile(db *storage.Database, ac
|
|||||||
if activeRemoteRequestResult, ok := activeRemoteRequests.MXCToResult[mxcURL]; ok {
|
if activeRemoteRequestResult, ok := activeRemoteRequests.MXCToResult[mxcURL]; ok {
|
||||||
r.Logger.Info("Waiting for another goroutine to fetch the remote file.")
|
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()
|
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
|
// check if we have a record of the media in our database
|
||||||
mediaMetadata, err := db.GetMediaMetadata(r.MediaMetadata.MediaID, r.MediaMetadata.Origin)
|
mediaMetadata, err := db.GetMediaMetadata(r.MediaMetadata.MediaID, r.MediaMetadata.Origin)
|
||||||
|
Loading…
Reference in New Issue
Block a user