What changed?binaryChecksum gets initialized somewhere early on in worker's lifecycle and then read many times. It was protected by a sync.Mutex for both reads and writes. Typically sync.Once is used for such scenarios but there is a SetBinaryChecksum() function exposed so it wouldn't work here.
Changing the implementation to avoid mutex locks for reads once binaryChecksum is initialized/set.
Why?
This change might not have visible performance improvements but still better to use atomic instead of a mutex each time binaryChecksum is read.
What changed?
binaryChecksum
gets initialized somewhere early on in worker's lifecycle and then read many times. It was protected by async.Mutex
for both reads and writes. Typicallysync.Once
is used for such scenarios but there is aSetBinaryChecksum()
function exposed so it wouldn't work here. Changing the implementation to avoid mutex locks for reads oncebinaryChecksum
is initialized/set.Why? This change might not have visible performance improvements but still better to use atomic instead of a mutex each time
binaryChecksum
is read.How did you test it?
make test
Potential risks N/A