Remove long wait for semaphore

This commit is contained in:
Tulir Asokan
2023-06-30 15:04:47 +03:00
parent 3eb5c44be3
commit 3c4561113b

View File

@@ -284,13 +284,8 @@ func (br *DiscordBridge) copyAttachmentToMatrix(intent *appservice.IntentAPI, ur
cancel() cancel()
if onceErr != nil { if onceErr != nil {
br.ZLog.Warn().Err(onceErr).Msg("Failed to acquire semaphore") br.ZLog.Warn().Err(onceErr).Msg("Failed to acquire semaphore")
ctx, cancel = context.WithTimeout(context.Background(), 50*time.Second) onceErr = fmt.Errorf("reuploading timed out")
onceErr = br.parallelAttachmentSemaphore.Acquire(ctx, attachmentSizeVal) return
cancel()
if onceErr != nil {
onceErr = fmt.Errorf("reuploading timed out")
return
}
} }
var semaWg sync.WaitGroup var semaWg sync.WaitGroup
semaWg.Add(1) semaWg.Add(1)