]> source.dussan.org Git - gitea.git/commit
Update User.NumRepos atomically in createRepository (#7493)
authorMonty Taylor <mordred@inaugust.com>
Wed, 17 Jul 2019 17:34:13 +0000 (13:34 -0400)
committertechknowlogick <techknowlogick@gitea.io>
Wed, 17 Jul 2019 17:34:13 +0000 (13:34 -0400)
commit361607d83109014a8dfd40e97c6f95a0e869dca3
tree48660e184f04da7741816b61c9e7648b71dea3f3
parent0e2996caa19892d2adf0720074bcffefe3c7535d
Update User.NumRepos atomically in createRepository (#7493)

The update call on the user call races if there is more than one
repository creation concurrently, leading to incorrect count of
repos. Split things in two, so that we call the update for last
visibility (which isn't problematic if it races, since it can only
ever be best-effort anyway). This way we can atomically increment
the count of repos.
models/repo.go