소스 검색

Fix attachment semaphore unlocking when download fails

Tulir Asokan 2 년 전
부모
커밋
3eb5c44be3
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      attachments.go

+ 1 - 1
attachments.go

@@ -294,6 +294,7 @@ func (br *DiscordBridge) copyAttachmentToMatrix(intent *appservice.IntentAPI, ur
 			}
 			var semaWg sync.WaitGroup
 			semaWg.Add(1)
+			defer semaWg.Done()
 			go func() {
 				semaWg.Wait()
 				br.parallelAttachmentSemaphore.Release(attachmentSizeVal)
@@ -321,7 +322,6 @@ func (br *DiscordBridge) copyAttachmentToMatrix(intent *appservice.IntentAPI, ur
 				onceDBFile.Insert(nil)
 			}
 			br.attachmentTransfers.Delete(transferKey)
-			semaWg.Done()
 			return
 		})
 	}