mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Merge commit 'e235c446c96280c015fb27f7eefe4e95a5a39892' into glitch-soc/merge-upstream
This commit is contained in:
@@ -4,7 +4,7 @@ require 'connection_pool'
|
||||
require_relative 'shared_timed_stack'
|
||||
|
||||
class ConnectionPool::SharedConnectionPool < ConnectionPool
|
||||
def initialize(options = {}, &block)
|
||||
def initialize(**, &block)
|
||||
super
|
||||
|
||||
@available = ConnectionPool::SharedTimedStack.new(@size, &block)
|
||||
|
||||
@@ -71,7 +71,7 @@ class EmojiFormatter
|
||||
private
|
||||
|
||||
def emoji_map
|
||||
@emoji_map ||= custom_emojis.each_with_object({}) { |e, h| h[e.shortcode] = [full_asset_url(e.image.url), full_asset_url(e.image.url(:static))] }
|
||||
@emoji_map ||= custom_emojis.to_h { |e| [e.shortcode, [full_asset_url(e.image.url), full_asset_url(e.image.url(:static))]] }
|
||||
end
|
||||
|
||||
def tag_for_emoji(shortcode, emoji)
|
||||
|
||||
@@ -51,7 +51,7 @@ class Importer::BaseImporter
|
||||
raise ActiveRecord::UnknownPrimaryKey, index.adapter.target if primary_key.nil?
|
||||
|
||||
ids = documents.pluck('_id')
|
||||
existence_map = index.adapter.target.where(primary_key => ids).pluck(primary_key).each_with_object({}) { |id, map| map[id.to_s] = true }
|
||||
existence_map = index.adapter.target.where(primary_key => ids).pluck(primary_key).to_h { |id| [id.to_s, true] }
|
||||
tmp = ids.reject { |id| existence_map[id] }
|
||||
|
||||
next if tmp.empty?
|
||||
|
||||
@@ -295,7 +295,7 @@ class Request
|
||||
Resolv::DNS.open do |dns|
|
||||
dns.timeouts = 5
|
||||
addresses = dns.getaddresses(host)
|
||||
addresses = addresses.filter { |addr| addr.is_a?(Resolv::IPv6) }.take(2) + addresses.filter { |addr| !addr.is_a?(Resolv::IPv6) }.take(2)
|
||||
addresses = addresses.grep(Resolv::IPv6).take(2) + addresses.grep_v(Resolv::IPv6).take(2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user