-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change createRepository to call PrepareWebhooks without xorm session #7447
Conversation
… to ensure transaction is directly. Signed-off-by: David Svantesson <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #7447 +/- ##
==========================================
- Coverage 41.2% 41.19% -0.01%
==========================================
Files 469 469
Lines 63557 63557
==========================================
- Hits 26190 26185 -5
- Misses 33946 33950 +4
- Partials 3421 3422 +1
Continue to review full report at Codecov.
|
This is for avoiding multiple database connections since sqlite may lock. |
The problem here is that the commit to sql database (of the hook_task) has to be done before the webhook is added to the queue. Otherwise the webhook might not be delivered (DeliverHooks in webhook.go read nothing from sql). If it is a problem to have multiple sql sessions at the same time, a larger change than what I have proposed would be needed. Maybe the PrepareWebhooks can move to the end of createRepository (as for delete repo) after closing sql session. However createRepository is also used by ForkRepository so it is not that easy. |
Yes, this is the bug, but your change will introduce another problem. I think we have to move |
Database session end in ForkRepository and CreateRepository. Drawback to move HookQueue.Add there is it will duplicate the call and maybe will make code somewhat less intuitive to follow. Not sure if there is some smarter way to refactor the code, or maybe that is acceptable solution? |
I close this PR as it wasn't a satisfactory solution for the issue. |
Thanks for your time and contribution. (Also thanks for closing this PR once it was no longer necessary) |
Changes the call in createRepository from prepareWebhooks to PrepareWebhooks, without the xorm session as argument. This is the same call as used in for example DeleteRepository.
I have tested this against issue #7404 and it should be solved with this fix.