mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: Restore missing_s3_uploads
stats count if site was restored (#27984)
This commit ensures that we reset the `missing_s3_uploads` status count if there are no inventory files which are at least 2 days older than the site's restored date. Otherwise, a site with missing uploads but was subsequntly restored will be continue to report missing uploads for 2 days.
This commit is contained in:

committed by
GitHub

parent
f5cbc3e3b8
commit
5038cad68e
@ -155,7 +155,7 @@ class S3Inventory
|
||||
end
|
||||
end
|
||||
|
||||
Discourse.stats.set("missing_s3_#{table_name}", missing_count)
|
||||
set_missing_s3_discourse_stats(missing_count)
|
||||
ensure
|
||||
connection.exec("DROP TABLE #{tmp_table_name}") unless connection.nil?
|
||||
end
|
||||
@ -250,6 +250,7 @@ class S3Inventory
|
||||
if BackupMetadata.last_restore_date.present? &&
|
||||
(symlink_file.last_modified - WAIT_AFTER_RESTORE_DAYS.days) <
|
||||
BackupMetadata.last_restore_date
|
||||
set_missing_s3_discourse_stats(0)
|
||||
return []
|
||||
end
|
||||
|
||||
@ -317,4 +318,8 @@ class S3Inventory
|
||||
def error(message)
|
||||
log(message, StandardError.new(message))
|
||||
end
|
||||
|
||||
def set_missing_s3_discourse_stats(count)
|
||||
Discourse.stats.set("missing_s3_#{@model.table_name}", count)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user