Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-12 00:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-12 00:09:09 +0300
commit19d63dbca44d8380b8bc0d51d890137691ddf2a7 (patch)
tree534885124a1edfcf4c22f61b93f6f8d270e03ac3 /app/experiments
parent9d195600e6266da44917f08c622a21a6d4c2317b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/experiments')
-rw-r--r--app/experiments/application_experiment.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/app/experiments/application_experiment.rb b/app/experiments/application_experiment.rb
index 6ba851fbc8b..019e74bcd48 100644
--- a/app/experiments/application_experiment.rb
+++ b/app/experiments/application_experiment.rb
@@ -9,11 +9,15 @@ class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/Namesp
Feature.get(feature_flag_name).state != :off # rubocop:disable Gitlab/AvoidFeatureGet
end
- def publish(_result)
+ def publish(_result = nil)
track(:assignment) # track that we've assigned a variant for this context
# push the experiment data to the client
- Gon.push({ experiment: { name => signature } }, true) if in_request_cycle?
+ begin
+ Gon.push({ experiment: { name => signature } }, true) # push the experiment data to the client
+ rescue NoMethodError
+ # means we're not in the request cycle, and can't add to Gon. Log a warning maybe?
+ end
end
def track(action, **event_args)
@@ -49,12 +53,6 @@ class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/Namesp
name.tr('/', '_')
end
- def in_request_cycle?
- # Gon is only accessible when having a request. This will be fixed with
- # https://gitlab.com/gitlab-org/gitlab/-/issues/323352
- context.instance_variable_defined?(:@request)
- end
-
def resolve_variant_name
case rollout_strategy
when :round_robin