Make Gitaly configuration immutable and local
The Gitaly config.Cfg
is a global mutable construct that abstracts away the state of the Gitaly configuration file. It has been the root of a number of race conditions. There are times where a test needs to add/remove storages to test a feature, and this can cause race conditions due to the concurrency inherent in a Gitaly server.
Since the contents of the file do not change once Gitaly starts, there is no need for the construct to be mutable. Whenever a test or server needs access to the configuration file, an immutable copy of the construct is preferable to prevent these race conditions from occurring.
Each service should get a dependency injected deep copy of the configuration file so that the configuration state is unable to change once the service starts.
-
objectpool
service -
repository
service -
commit
service -
diff
service -
hook
service the dependent code gone -
objectpool
-
remote
-
smarthttp
-
ssh
-
wiki
-
namespace
...