Class: Gitlab::Memory::UploadAndCleanupReports
- Inherits:
-
Object
- Object
- Gitlab::Memory::UploadAndCleanupReports
- Defined in:
- lib/gitlab/memory/upload_and_cleanup_reports.rb
Constant Summary collapse
- DEFAULT_SLEEP_TIME_SECONDS =
15 minutes
900
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#reports_path ⇒ Object
readonly
Returns the value of attribute reports_path.
-
#sleep_time_seconds ⇒ Object
readonly
Returns the value of attribute sleep_time_seconds.
-
#uploader ⇒ Object
readonly
Returns the value of attribute uploader.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(uploader:, reports_path:, logger:, sleep_time_seconds: ENV['GITLAB_DIAGNOSTIC_REPORTS_UPLOADER_SLEEP_S']&.to_i || DEFAULT_SLEEP_TIME_SECONDS) ⇒ UploadAndCleanupReports
constructor
A new instance of UploadAndCleanupReports.
Constructor Details
#initialize(uploader:, reports_path:, logger:, sleep_time_seconds: ENV['GITLAB_DIAGNOSTIC_REPORTS_UPLOADER_SLEEP_S']&.to_i || DEFAULT_SLEEP_TIME_SECONDS) ⇒ UploadAndCleanupReports
Returns a new instance of UploadAndCleanupReports.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gitlab/memory/upload_and_cleanup_reports.rb', line 8 def initialize( uploader:, reports_path:, logger:, sleep_time_seconds: ENV['GITLAB_DIAGNOSTIC_REPORTS_UPLOADER_SLEEP_S']&.to_i || DEFAULT_SLEEP_TIME_SECONDS) @uploader = uploader @reports_path = reports_path @sleep_time_seconds = sleep_time_seconds @alive = true @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
21 22 23 |
# File 'lib/gitlab/memory/upload_and_cleanup_reports.rb', line 21 def logger @logger end |
#reports_path ⇒ Object (readonly)
Returns the value of attribute reports_path.
21 22 23 |
# File 'lib/gitlab/memory/upload_and_cleanup_reports.rb', line 21 def reports_path @reports_path end |
#sleep_time_seconds ⇒ Object (readonly)
Returns the value of attribute sleep_time_seconds.
21 22 23 |
# File 'lib/gitlab/memory/upload_and_cleanup_reports.rb', line 21 def sleep_time_seconds @sleep_time_seconds end |
#uploader ⇒ Object (readonly)
Returns the value of attribute uploader.
21 22 23 |
# File 'lib/gitlab/memory/upload_and_cleanup_reports.rb', line 21 def uploader @uploader end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/gitlab/memory/upload_and_cleanup_reports.rb', line 23 def call log_started loop do sleep(sleep_time_seconds) files_to_process.each { |path| upload_and_cleanup!(path) } end end |