diff options
author | Claire <claire.github-309c@sitedethib.com> | 2020-12-15 14:27:06 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2020-12-15 14:27:06 +0100 |
commit | e4f8679eaeea062e1f9ca9f58703b51ff8162c35 (patch) | |
tree | 13940a853f1278a3c4ef89dd3a0bbedfeaaf7140 /lib | |
parent | 1978f7265e1e83bda25413da26f53c53110af764 (diff) | |
parent | 8485c436d5d083c28df8c942fe521bfb46edfc9f (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `app/models/form/admin_settings.rb`: New setting added upstream. Ported it. - `app/views/statuses/_simple_status.html.haml`: Upstream removed RTL classes. Did the same. - `config/settings.yml`: New setting added upstream. Ported it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mastodon/domains_cli.rb | 4 | ||||
-rw-r--r-- | lib/mastodon/maintenance_cli.rb | 2 | ||||
-rw-r--r-- | lib/paperclip/attachment_extensions.rb | 17 |
3 files changed, 21 insertions, 2 deletions
diff --git a/lib/mastodon/domains_cli.rb b/lib/mastodon/domains_cli.rb index 5433ddd9d..3c2dfd4ec 100644 --- a/lib/mastodon/domains_cli.rb +++ b/lib/mastodon/domains_cli.rb @@ -53,6 +53,8 @@ module Mastodon custom_emojis_count = custom_emojis.count custom_emojis.destroy_all unless options[:dry_run] + Instance.refresh unless options[:dry_run] + say("Removed #{custom_emojis_count} custom emojis", :green) end @@ -83,7 +85,7 @@ module Mastodon processed = Concurrent::AtomicFixnum.new(0) failed = Concurrent::AtomicFixnum.new(0) start_at = Time.now.to_f - seed = start ? [start] : Account.remote.domains + seed = start ? [start] : Instance.pluck(:domain) blocked_domains = Regexp.new('\\.?' + DomainBlock.where(severity: 1).pluck(:domain).join('|') + '$') progress = create_progress_bar diff --git a/lib/mastodon/maintenance_cli.rb b/lib/mastodon/maintenance_cli.rb index 99d13f43d..ffad3f6a2 100644 --- a/lib/mastodon/maintenance_cli.rb +++ b/lib/mastodon/maintenance_cli.rb @@ -14,7 +14,7 @@ module Mastodon end MIN_SUPPORTED_VERSION = 2019_10_01_213028 - MAX_SUPPORTED_VERSION = 2020_10_17_234926 + MAX_SUPPORTED_VERSION = 2020_12_06_004238 # Stubs to enjoy ActiveRecord queries while not depending on a particular # version of the code/database diff --git a/lib/paperclip/attachment_extensions.rb b/lib/paperclip/attachment_extensions.rb index 752e79e65..94f7769b6 100644 --- a/lib/paperclip/attachment_extensions.rb +++ b/lib/paperclip/attachment_extensions.rb @@ -39,6 +39,23 @@ module Paperclip def default_url(style_name = default_style) @url_generator.for_as_default(style_name) end + + STOPLIGHT_THRESHOLD = 10 + STOPLIGHT_COOLDOWN = 30 + + # We overwrite this method to put a circuit breaker around + # calls to object storage, to stop hitting APIs that are slow + # to respond or don't respond at all and as such minimize the + # impact of object storage outages on application throughput + def save + Stoplight('object-storage') { super }.with_threshold(STOPLIGHT_THRESHOLD).with_cool_off_time(STOPLIGHT_COOLDOWN).with_error_handler do |error, handle| + if error.is_a?(Seahorse::Client::NetworkingError) + handle.call(error) + else + raise error + end + end.run + end end end |