diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-02 18:09:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-02 18:09:11 +0300 |
commit | 97d12c74e9ac60960c8dfc35cf5502d815d84b83 (patch) | |
tree | 359215d715be4565b6c5cc9ff8055d9a55291dd6 /app/services/concerns | |
parent | 3d58e50a8fd9d07ebe115fc10ff1404e04f6f756 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/concerns')
-rw-r--r-- | app/services/concerns/projects/remove_refs.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/services/concerns/projects/remove_refs.rb b/app/services/concerns/projects/remove_refs.rb new file mode 100644 index 00000000000..d133aa0ced6 --- /dev/null +++ b/app/services/concerns/projects/remove_refs.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Projects + module RemoveRefs + extend ActiveSupport::Concern + include Gitlab::ExclusiveLeaseHelpers + + LOCK_RETRY = 3 + LOCK_TTL = 5.minutes + LOCK_SLEEP = 0.5.seconds + + def serialized_remove_refs(project_id, &blk) + in_lock("projects/#{project_id}/serialized_remove_refs", **lock_params, &blk) + end + + def lock_params + { + ttl: LOCK_TTL, + retries: LOCK_RETRY, + sleep_sec: LOCK_SLEEP + } + end + end +end |