diff --git a/.rubocop.yml b/.rubocop.yml index 8be3fdd2307774fcb44c7c1ee3a35e8017dcedaa..2a180ad20cb0b987a6a74b976a83e606452768e0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -77,6 +77,7 @@ Naming/FileName: - 'qa/spec/**/*' - 'qa/qa/specs/**/*' - 'qa/bin/*' + - 'ee/bin/*' - 'config/**/*' - 'ee/config/**/*' - 'lib/generators/**/*' diff --git a/bin/geo_log_cursor b/ee/bin/geo_log_cursor similarity index 80% rename from bin/geo_log_cursor rename to ee/bin/geo_log_cursor index a4acf71fa84f5e52996b49ae93e45842d75407ba..69a6b89ff4ddddf42385eea22881ce26c13aab61 100755 --- a/bin/geo_log_cursor +++ b/ee/bin/geo_log_cursor @@ -1,9 +1,14 @@ #!/usr/bin/env ruby -# vim: ft=ruby +# frozen_string_literal: true + require 'rubygems' require 'bundler/setup' require 'optparse' +def rails_path(relname) + Pathname.new(__FILE__).dirname.join('../..').join(relname).realpath +end + class GeoLogCursorOptionParser def self.parse(argv) options = {} @@ -22,7 +27,7 @@ class GeoLogCursorOptionParser end op.on('-v', '--version') do # Load only necessary libraries for faster startup - require "#{File.dirname(__FILE__)}/../lib/gitlab/geo/log_cursor/daemon" + require rails_path('ee/lib/gitlab/geo/log_cursor/daemon.rb') puts Gitlab::Geo::LogCursor::Daemon::VERSION exit @@ -39,7 +44,7 @@ if $0 == __FILE__ options = GeoLogCursorOptionParser.parse(ARGV) # We load rails environment / initializers only here to get faster command line startup when `--help` and `--version` - require "#{File.dirname(__FILE__)}/../config/environment" + require rails_path('config/environment.rb') Gitlab::Geo::LogCursor::Daemon.new(options).run! end diff --git a/ee/changelogs/unreleased/tc-move-geo-cursor-bin.yml b/ee/changelogs/unreleased/tc-move-geo-cursor-bin.yml new file mode 100644 index 0000000000000000000000000000000000000000..a40cde834984d3dee3c7e469881648663bcc0358 --- /dev/null +++ b/ee/changelogs/unreleased/tc-move-geo-cursor-bin.yml @@ -0,0 +1,5 @@ +--- +title: Move geo_log_cursor binary to the ee folder +merge_request: 10821 +author: +type: other diff --git a/ee/lib/gitlab/geo/log_cursor/daemon.rb b/ee/lib/gitlab/geo/log_cursor/daemon.rb index 1c548ce7a16f4d1e074ce5ce05f764358b7d9f7a..cc9c3eb51241f93fafa4fd8e754505aaec4b45d6 100644 --- a/ee/lib/gitlab/geo/log_cursor/daemon.rb +++ b/ee/lib/gitlab/geo/log_cursor/daemon.rb @@ -4,11 +4,9 @@ module Gitlab module Geo module LogCursor class Daemon - include Utils::StrongMemoize - VERSION = '0.2.0'.freeze BATCH_SIZE = 250 - SECONDARY_CHECK_INTERVAL = 1.minute + SECONDARY_CHECK_INTERVAL = 60 attr_reader :options @@ -130,9 +128,7 @@ def gap_tracking end def logger - strong_memoize(:logger) do - Gitlab::Geo::LogCursor::Logger.new(self.class, log_level) - end + @logger ||= Gitlab::Geo::LogCursor::Logger.new(self.class, log_level) end def log_level