insights: lock aggregation updates
Created by: leonore
closes #41423 (closed)
we think that we didn't notice this unsafe behaviour sooner because we expected type:commit
queries to time out, and commit search triggers a search of each repo in a separate go routine which would have triggered this concurrent access
Test plan
Ran a type:commit
query locally and observed it worked rather than panicked the whole instance
Also tested the sync lock on a lower level in another branch with go test -race
we went with the safety of a lock at the higher level function (to also align with search's implementation)