DEV: Prevents rate limits for new feature checks on multisite (#12053)

This commit is contained in:
Penar Musaraj
2021-02-12 08:52:59 -05:00
committed by GitHub
parent 144584aacb
commit 900d4187ef
3 changed files with 15 additions and 4 deletions

View File

@ -115,10 +115,14 @@ module DiscourseUpdates
keys.present? ? keys.map { |k| Discourse.redis.hgetall(k) } : []
end
def perform_new_feature_check
def new_features_payload
response = Excon.new(new_features_endpoint).request(expects: [200], method: :Get)
json = JSON.parse(response.body)
Discourse.redis.set(new_features_key, response.body)
JSON.parse(response.body)
end
def update_new_features(json = nil)
json ||= new_features_payload
Discourse.redis.set(new_features_key, json)
end
def new_features