The disableMutex variable is not thread-safe as it is globally referenced but not protected by a mutex.
That said, rather than fix this issue, I suggest we remove the client mutex entirely. Evidence this is safe:
- SQLite3 is thread-safe by default.
- The SQLite3 library we use ensures the DB was compiled for thread-safety.
- All tests pass still pass after removing the mutex.
- Running
registry upload bulk discovery --jobs 100 is successful after removing the mutex.