Compare commits
No commits in common. "9254dc20c8db6e09cb32025631719277138d2828" and "775d3f7e6ffc5a55f475a8b86a42db1f27ab81bb" have entirely different histories.
9254dc20c8
...
775d3f7e6f
|
@ -496,12 +496,11 @@ func (t *TusHandler) worker() {
|
||||||
|
|
||||||
mapKey := append([]byte{}, decodedHash.HashBytes()...)
|
mapKey := append([]byte{}, decodedHash.HashBytes()...)
|
||||||
mapKey = append(mapKey, []byte(info.Upload.ID)...)
|
mapKey = append(mapKey, []byte(info.Upload.ID)...)
|
||||||
mapKeyStr := string(mapKey)
|
if _, ok := t.uploadMutexMap.Load(mapKey); !ok {
|
||||||
if _, ok := t.uploadMutexMap.Load(mapKeyStr); !ok {
|
t.uploadMutexMap.Store(mapKey, &sync.Mutex{})
|
||||||
t.uploadMutexMap.Store(mapKeyStr, &sync.Mutex{})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex, _ := t.uploadMutexMap.Load(mapKeyStr)
|
mutex, _ := t.uploadMutexMap.Load(mapKey)
|
||||||
|
|
||||||
mutex.(*sync.Mutex).Lock()
|
mutex.(*sync.Mutex).Lock()
|
||||||
exists, _ := t.UploadExists(ctx, decodedHash.HashBytes())
|
exists, _ := t.UploadExists(ctx, decodedHash.HashBytes())
|
||||||
|
@ -512,7 +511,7 @@ func (t *TusHandler) worker() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = t.CreateUpload(ctx, decodedHash.HashBytes(), info.Upload.ID, uploaderID, uploaderIP, t.storageProtocol.Name())
|
_, err = t.CreateUpload(ctx, mapKey, info.Upload.ID, uploaderID, uploaderIP, t.storageProtocol.Name())
|
||||||
mutex.(*sync.Mutex).Unlock()
|
mutex.(*sync.Mutex).Unlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorResponse.Body = "Could not create tus upload"
|
errorResponse.Body = "Could not create tus upload"
|
||||||
|
|
Loading…
Reference in New Issue