Commit dbd388d5 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'use-after-transition-ee' into 'master'

Prefer to use after_transition

Closes gitlab-ce#55306

See merge request gitlab-org/gitlab-ee!8839
parents 905f6960 d22e0eb2
...@@ -221,6 +221,10 @@ module Ci ...@@ -221,6 +221,10 @@ module Ci
next unless build.project next unless build.project
build.deployment&.drop build.deployment&.drop
end
after_transition any => [:failed] do |build|
next unless build.project
if build.retry_failure? if build.retry_failure?
begin begin
......
...@@ -23,7 +23,7 @@ module Clusters ...@@ -23,7 +23,7 @@ module Clusters
FETCH_IP_ADDRESS_DELAY = 30.seconds FETCH_IP_ADDRESS_DELAY = 30.seconds
state_machine :status do state_machine :status do
before_transition any => [:installed] do |application| after_transition any => [:installed] do |application|
application.run_after_commit do application.run_after_commit do
ClusterWaitForIngressIpAddressWorker.perform_in( ClusterWaitForIngressIpAddressWorker.perform_in(
FETCH_IP_ADDRESS_DELAY, application.name, application.id) FETCH_IP_ADDRESS_DELAY, application.name, application.id)
......
...@@ -20,7 +20,7 @@ module Clusters ...@@ -20,7 +20,7 @@ module Clusters
self.reactive_cache_key = ->(knative) { [knative.class.model_name.singular, knative.id] } self.reactive_cache_key = ->(knative) { [knative.class.model_name.singular, knative.id] }
state_machine :status do state_machine :status do
before_transition any => [:installed] do |application| after_transition any => [:installed] do |application|
application.run_after_commit do application.run_after_commit do
ClusterWaitForIngressIpAddressWorker.perform_in( ClusterWaitForIngressIpAddressWorker.perform_in(
FETCH_IP_ADDRESS_DELAY, application.name, application.id) FETCH_IP_ADDRESS_DELAY, application.name, application.id)
......
...@@ -107,7 +107,9 @@ class MergeRequest < ActiveRecord::Base ...@@ -107,7 +107,9 @@ class MergeRequest < ActiveRecord::Base
before_transition any => :opened do |merge_request| before_transition any => :opened do |merge_request|
merge_request.merge_jid = nil merge_request.merge_jid = nil
end
after_transition any => :opened do |merge_request|
merge_request.run_after_commit do merge_request.run_after_commit do
UpdateHeadPipelineForMergeRequestWorker.perform_async(merge_request.id) UpdateHeadPipelineForMergeRequestWorker.perform_async(merge_request.id)
end end
......
...@@ -59,7 +59,9 @@ module EE ...@@ -59,7 +59,9 @@ module EE
state.reset_retry_count state.reset_retry_count
state.set_next_execution_timestamp state.set_next_execution_timestamp
end end
end
after_transition started: :finished do |state, _|
if ::Gitlab::CurrentSettings.current_application_settings.elasticsearch_indexing? if ::Gitlab::CurrentSettings.current_application_settings.elasticsearch_indexing?
state.run_after_commit do state.run_after_commit do
last_indexed_commit = state.project.index_status&.last_commit last_indexed_commit = state.project.index_status&.last_commit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment