uber-go / cadence-client

Framework for authoring workflows and activities running on top of the Cadence orchestration engine.
https://cadenceworkflow.io
MIT License
339 stars 128 forks source link

Improve retrieval of binaryChecksum #1279

Closed taylanisikdemir closed 8 months ago

taylanisikdemir commented 8 months ago

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.

How did you test it? make test

Potential risks N/A

CLAassistant commented 8 months ago

CLA assistant check
All committers have signed the CLA.