Handle the great race on pipeline

So now we have Gitlab::OptimisticLocking in a few places for pipelines/builds, while fine grained locking is a solution, could we find out a less error prune way to handle this?

This question has been raised for a number of times, and the most recent one is in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7508#note_18727673

gitlab-ce!6984 is also a similar attempt to fix a particular issue.

/cc @grzesiek @ayufan

Assignee Loading
Time tracking Loading