From eb7390edf3afd52174b786fff1e06d5ffae0cec5 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 25 Nov 2019 21:06:28 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb | 4 +++- lib/gitlab/gpg.rb | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb b/lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb index 667d6def414..0c75a141c3c 100644 --- a/lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb +++ b/lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb @@ -8,6 +8,8 @@ module Gitlab class StageEvent include Gitlab::CycleAnalytics::MetricsTables + delegate :label_based?, to: :class + def initialize(params) @params = params end @@ -35,7 +37,7 @@ module Gitlab query end - def label_based? + def self.label_based? false end diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb index 1dce26efc65..829e64b11a4 100644 --- a/lib/gitlab/gpg.rb +++ b/lib/gitlab/gpg.rb @@ -5,7 +5,7 @@ module Gitlab extend self CleanupError = Class.new(StandardError) - BG_CLEANUP_RUNTIME_S = 2 + BG_CLEANUP_RUNTIME_S = 10 FG_CLEANUP_RUNTIME_S = 0.5 MUTEX = Mutex.new @@ -107,19 +107,18 @@ module Gitlab begin cleanup_tmp_dir(tmp_dir) rescue CleanupError => e + folder_contents = Dir.children(tmp_dir) # This means we left a GPG-agent process hanging. Logging the problem in # sentry will make this more visible. Gitlab::Sentry.track_exception(e, issue_url: 'https://gitlab.com/gitlab-org/gitlab/issues/20918', - extra: { tmp_dir: tmp_dir }) + extra: { tmp_dir: tmp_dir, contents: folder_contents }) end tmp_keychains_removed.increment unless File.exist?(tmp_dir) end def cleanup_tmp_dir(tmp_dir) - return FileUtils.remove_entry(tmp_dir, true) if Feature.disabled?(:gpg_cleanup_retries) - # Retry when removing the tmp directory failed, as we may run into a # race condition: # The `gpg-agent` agent process may clean up some files as well while -- cgit v1.2.3