distgit/pagure: actually apply the hotfix

So in out dist-git setup the git hook have a dedicated configuration
file which only contains a read-only access to the database.
This is because of the way our dist-git is setup where every packager
actually has a shell account on the machine and the hook are run by
that account.
So if the packager manages to get a shell access, they will be able to
read this configuration file and we do not want to give them read/write
access to the database.
Pagure however in the default hook tries to update the database, among
other it tries to clear the cached merge status of the open PR when a
commit is pushed.
For a nice UX, it does this within the hook process, this way there is
no race-condition and users accessing a PR right after a push will get
an up to date merge status (as it will be re-generated).
But we cannot do this in dist-git since we cannot update the database
directly, so instead, with this hotfix, we move the process of cleaning
up the merge status to an async job that will have read/write access
and there may be some race-condition in displaying the merge status
but so be it.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2019-03-07 16:26:06 +01:00
parent 3730434eab
commit 6ae1ad74d4

View file

@ -329,7 +329,7 @@ class DefaultRunner(BaseRunner):
# Refresh of all opened PRs
parent = project.parent or project
pagure.lib.tasks.refresh_pr_cache(
pagure.lib.tasks.refresh_pr_cache.delay(
parent.name,
parent.namespace,
parent.user.user if parent.is_fork else None,