mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] forwardport: mitigate cat-file not finding commit on updates
Fix #457 hopefully: I didn't manage to repro / create a test for. It looks like in some cases during the update process the PR ref lags behind the branch itself. This means `forwardport.updates` creates a new commit, pushes it, then on the next iteration updates the local cache, tries to find the commit we just pushed... and that fails. I can only assume this is because when there's enough load on the github side the update to the `info/refs` pseudo-file can fall behind (it's now 4MB and holding nearly 65k refs). So cheat: take the commit we just pushed to the dev remote and... immediately push it to the local cache under a dummy branch, which we delete. Since we only gc "1 day ago" this should not vacuum.
This commit is contained in:
parent
8a924fb4b7
commit
0b1e33da7c
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import logging
|
import logging
|
||||||
|
import uuid
|
||||||
from contextlib import ExitStack
|
from contextlib import ExitStack
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@ -128,6 +129,16 @@ class UpdateQueue(models.Model, Queue):
|
|||||||
'squash': commits_count == 1,
|
'squash': commits_count == 1,
|
||||||
})
|
})
|
||||||
working_copy.push('-f', 'target', child.refname)
|
working_copy.push('-f', 'target', child.refname)
|
||||||
|
|
||||||
|
# also push to local cache: looks like in some cases github
|
||||||
|
# doesn't propagate revisions (?) or at least does so too slowly
|
||||||
|
# so on the next loop we try to fetch the revision we just
|
||||||
|
# pushed through PR and... we can't find it
|
||||||
|
dummy_branch = str(uuid.uuid4())
|
||||||
|
ref = previous._get_local_directory()
|
||||||
|
working_copy.push(ref._directory, f'{new_head}:refs/heads/{dummy_branch}')
|
||||||
|
ref.branch('--delete', '--force', dummy_branch)
|
||||||
|
|
||||||
# committing here means github could technically trigger its
|
# committing here means github could technically trigger its
|
||||||
# webhook before sending a response, but committing before
|
# webhook before sending a response, but committing before
|
||||||
# would mean we can update the PR in database but fail to
|
# would mean we can update the PR in database but fail to
|
||||||
|
Loading…
Reference in New Issue
Block a user