-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1933 from brave-intl/staging
Release 2019-05-31
- Loading branch information
Showing
10 changed files
with
71 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
class CacheBrowserChannelsJsonJob < ApplicationJob | ||
queue_as :heavy | ||
|
||
MAX_RETRY = 10 | ||
|
||
def perform | ||
channels_json = JsonBuilders::ChannelsJsonBuilder.new.build | ||
result = Rails.cache.write('browser_channels_json', channels_json) | ||
Rails.logger.info("CacheBrowserChannelsJsonJob updated the cached browser channels json. Result: #{result}") | ||
retry_count = 0 | ||
result = nil | ||
|
||
loop do | ||
result = Rails.cache.write('browser_channels_json', channels_json) | ||
break if result || retry_count > MAX_RETRY | ||
|
||
retry_count += 1 | ||
Rails.logger.info("CacheBrowserChannelsJsonJob could not write to Redis result: #{result}. Retrying: #{retry_count}/#{MAX_RETRY}") | ||
end | ||
|
||
if result | ||
Rails.logger.info("CacheBrowserChannelsJsonJob updated the cached browser channels json.") | ||
else | ||
SlackMessenger.new(message: "🚨 CacheBrowserChannelsJsonJob could not update the channels JSON. @publishers-team 🚨") | ||
Rails.logger.info("CacheBrowserChannelsJsonJob could not update the channels JSON.") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.