mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
FEATURE: Create new helper method 'Discourse.stats' (#7388)
This commit is contained in:
parent
ba6d4b2a8d
commit
a8f410a9c5
@ -468,6 +468,10 @@ module Discourse
|
||||
end
|
||||
end
|
||||
|
||||
def self.stats
|
||||
@stats ||= PluginStore.new("stats")
|
||||
end
|
||||
|
||||
def self.current_user_provider
|
||||
@current_user_provider || Auth::DefaultCurrentUserProvider
|
||||
end
|
||||
|
@ -65,7 +65,7 @@ class S3Inventory
|
||||
log "#{missing_count} of #{uploads.count} #{model.name.underscore.pluralize} are missing"
|
||||
end
|
||||
|
||||
$redis.set("missing_s3_#{model.table_name}", missing_count)
|
||||
Discourse.stats.set("missing_s3_#{model.table_name}", missing_count)
|
||||
ensure
|
||||
connection.exec("DROP TABLE #{table_name}") unless connection.nil?
|
||||
end
|
||||
|
@ -75,7 +75,7 @@ describe "S3Inventory" do
|
||||
end
|
||||
|
||||
expect(output).to eq("#{upload.url}\n1 of 4 uploads are missing\n")
|
||||
expect($redis.get("missing_s3_uploads")).to eq("1")
|
||||
expect(Discourse.stats.get("missing_s3_uploads")).to eq(1)
|
||||
end
|
||||
|
||||
it "should backfill etags to uploads table correctly" do
|
||||
|
Loading…
Reference in New Issue
Block a user