FIX: increase inventory lag for s3 to 2 days (#11606)

Inventory on S3 always lagged, over the past few weeks we are noticing that
1 day of lag is not enough.

We are increasing this to 2, to ensure that we do not get false positive
reports.
This commit is contained in:
Sam 2020-12-30 16:05:42 +11:00 committed by GitHub
parent 6b53f26fc0
commit e0c952290b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ class S3Inventory
CSV_ETAG_INDEX ||= 2 CSV_ETAG_INDEX ||= 2
INVENTORY_PREFIX ||= "inventory" INVENTORY_PREFIX ||= "inventory"
INVENTORY_VERSION ||= "1" INVENTORY_VERSION ||= "1"
INVENTORY_LAG ||= 2.days
def initialize(s3_helper, type, preloaded_inventory_file: nil, preloaded_inventory_date: nil) def initialize(s3_helper, type, preloaded_inventory_file: nil, preloaded_inventory_date: nil)
@s3_helper = s3_helper @s3_helper = s3_helper
@ -237,7 +238,7 @@ class S3Inventory
symlink_file = unsorted_files.sort_by { |file| -file.last_modified.to_i }.first symlink_file = unsorted_files.sort_by { |file| -file.last_modified.to_i }.first
return [] if symlink_file.blank? return [] if symlink_file.blank?
@inventory_date = symlink_file.last_modified - 1.day @inventory_date = symlink_file.last_modified - INVENTORY_LAG
log "Downloading symlink file to tmp directory..." log "Downloading symlink file to tmp directory..."
failure_message = "Failed to download symlink file to tmp directory." failure_message = "Failed to download symlink file to tmp directory."
filename = File.join(tmp_directory, File.basename(symlink_file.key)) filename = File.join(tmp_directory, File.basename(symlink_file.key))