add locking to map reads
This commit is contained in:
parent
a4c6b2da30
commit
c402a1cdef
1 changed files with 4 additions and 0 deletions
|
@ -475,7 +475,9 @@ func (s *Sync) updateRemoteDB(claims []jsonrpc.Claim) (total, fixed, removed int
|
||||||
tn := c.Value.GetThumbnail().GetUrl()
|
tn := c.Value.GetThumbnail().GetUrl()
|
||||||
videoID := tn[strings.LastIndex(tn, "/")+1:]
|
videoID := tn[strings.LastIndex(tn, "/")+1:]
|
||||||
videoIDMap[videoID] = c.ClaimID
|
videoIDMap[videoID] = c.ClaimID
|
||||||
|
s.syncedVideosMux.RLock()
|
||||||
pv, claimInDatabase := s.syncedVideos[videoID]
|
pv, claimInDatabase := s.syncedVideos[videoID]
|
||||||
|
s.syncedVideosMux.RUnlock()
|
||||||
claimMetadataVersion := uint(1)
|
claimMetadataVersion := uint(1)
|
||||||
if strings.Contains(tn, thumbs.ThumbnailEndpoint) {
|
if strings.Contains(tn, thumbs.ThumbnailEndpoint) {
|
||||||
claimMetadataVersion = 2
|
claimMetadataVersion = 2
|
||||||
|
@ -722,7 +724,9 @@ func (s *Sync) startWorker(workerNum int) {
|
||||||
}
|
}
|
||||||
SendErrorToSlack("Video failed after %d retries, skipping. Stack: %s", tryCount, logMsg)
|
SendErrorToSlack("Video failed after %d retries, skipping. Stack: %s", tryCount, logMsg)
|
||||||
}
|
}
|
||||||
|
s.syncedVideosMux.RLock()
|
||||||
existingClaim, ok := s.syncedVideos[v.ID()]
|
existingClaim, ok := s.syncedVideos[v.ID()]
|
||||||
|
s.syncedVideosMux.RUnlock()
|
||||||
existingClaimID := ""
|
existingClaimID := ""
|
||||||
existingClaimName := ""
|
existingClaimName := ""
|
||||||
existingClaimSize := int64(0)
|
existingClaimSize := int64(0)
|
||||||
|
|
Loading…
Reference in a new issue