Explorar el Código

Fix attachment semaphore unlocking when download fails

Tulir Asokan hace 2 años
padre
commit
3eb5c44be3
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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
 			var semaWg sync.WaitGroup
 			semaWg.Add(1)
 			semaWg.Add(1)
+			defer semaWg.Done()
 			go func() {
 			go func() {
 				semaWg.Wait()
 				semaWg.Wait()
 				br.parallelAttachmentSemaphore.Release(attachmentSizeVal)
 				br.parallelAttachmentSemaphore.Release(attachmentSizeVal)
@@ -321,7 +322,6 @@ func (br *DiscordBridge) copyAttachmentToMatrix(intent *appservice.IntentAPI, ur
 				onceDBFile.Insert(nil)
 				onceDBFile.Insert(nil)
 			}
 			}
 			br.attachmentTransfers.Delete(transferKey)
 			br.attachmentTransfers.Delete(transferKey)
-			semaWg.Done()
 			return
 			return
 		})
 		})
 	}
 	}