#4081 Make update_pull_ref more robust by making sure fork ref is deleted
Merged by pingou. Opened by bkabrda.
bkabrda/pagure robust-update-pull-ref  into  master

Download 4081.patch

I've seen some errors from the sync_pull_ref task that uses update_pull_ref function. After looking into this, my best guess is that some workers failed/were restarted before being able to get the finally clause, thus not deleting the pull ref in the fork. This means that on subsequent runs for the same PR, the sync_pull_ref task would always fail. This patch fixes that by making sure the ref is deleted before it's created again, so this shouldn't happen again.
The possible downside of this (which IMO doesn't hurt) is that the pull ref can stay in the fork forever, but I don't see it as a huge issue. We could use both the try/finally approach and this new approach to prevent this from happening as much as possible.

Tests are coming :)

what about doing both, adding this block and keep the one below as is?

Yeah, as mentioned in the initial comment, that may actually be the best course of action. I'll do that.

rebased onto d30b768e254442bae9abdc33b0582beac1be7edb

Fixed and added a thorough test for the update_pull_ref function.

rebased onto 197fa260ea5f86e4d5cedc88380c027d32dafe44

Thanks for this! :)

Pull-Request has been merged by pingou

Metadata