summaryrefslogtreecommitdiffstats
path: root/modules/queue
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-04-10 09:27:29 +0100
committerGitHub <noreply@github.com>2021-04-10 09:27:29 +0100
commit84f5a0bc62568b6d0a67969e460f4d41339a07d6 (patch)
tree482b1254ec65ad3c1c001d4e9229c309a7ad7cf9 /modules/queue
parente375cbfd464e12a704c3c1325315a0381ab877a7 (diff)
downloadgitea-84f5a0bc62568b6d0a67969e460f4d41339a07d6.tar.gz
gitea-84f5a0bc62568b6d0a67969e460f4d41339a07d6.zip
Always set the merge base used to merge the commit (#15352)
The issue is that the TestPatch will reset the PR MergeBase - and it is possible for TestPatch to update the MergeBase whilst a merge is ongoing. The ensuing merge will then complete but it doesn't re-set the MergeBase it used to merge the PR. Fixes the intermittent error in git test. Signed-off-by: Andrew Thornton art27@cantab.net
Diffstat (limited to 'modules/queue')
-rw-r--r--modules/queue/manager.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/queue/manager.go b/modules/queue/manager.go
index d44007a0f0..da0fc606e6 100644
--- a/modules/queue/manager.go
+++ b/modules/queue/manager.go
@@ -174,6 +174,7 @@ func (m *Manager) FlushAll(baseCtx context.Context, timeout time.Duration) error
default:
}
mqs := m.ManagedQueues()
+ log.Debug("Found %d Managed Queues", len(mqs))
wg := sync.WaitGroup{}
wg.Add(len(mqs))
allEmpty := true
@@ -184,6 +185,7 @@ func (m *Manager) FlushAll(baseCtx context.Context, timeout time.Duration) error
}
allEmpty = false
if flushable, ok := mq.Managed.(Flushable); ok {
+ log.Debug("Flushing (flushable) queue: %s", mq.Name)
go func(q *ManagedQueue) {
localCtx, localCancel := context.WithCancel(ctx)
pid := q.RegisterWorkers(1, start, hasTimeout, end, localCancel, true)
@@ -196,7 +198,11 @@ func (m *Manager) FlushAll(baseCtx context.Context, timeout time.Duration) error
wg.Done()
}(mq)
} else {
- wg.Done()
+ log.Debug("Queue: %s is non-empty but is not flushable - adding 100 millisecond wait", mq.Name)
+ go func() {
+ <-time.After(100 * time.Millisecond)
+ wg.Done()
+ }()
}
}