keyMutexIndex calculates mutex index based on key
(key []byte)
| 22 | |
| 23 | // Global mutex for same source/destination RPOPLPUSH operations |
| 24 | var sameKeyMutex sync.Mutex |
| 25 | |
| 26 | // keyMutexIndex calculates mutex index based on key |
| 27 | func keyMutexIndex(key []byte) uint32 { |
| 28 | h := fnv.New32a() |
| 29 | h.Write(key) |
| 30 | return h.Sum32() % mutexCount |
| 31 | } |