Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/packs/admin.js`: Conflicts due to glitch-soc's theming system. Upstream changes have been ported to `app/javascript/core/admin.js` - `app/models/trends/statuses.rb`: Minor conflict due to glitch-soc's option to allow CWed toots in trends. Ported upstream changes.
This commit is contained in:
@@ -19,15 +19,18 @@ module Mastodon
|
||||
ProgressBar.create(total: total, format: '%c/%u |%b%i| %e')
|
||||
end
|
||||
|
||||
def reset_connection_pools!
|
||||
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Rails.env].dup.tap { |config| config['pool'] = options[:concurrency] + 1 })
|
||||
RedisConfiguration.establish_pool(options[:concurrency])
|
||||
end
|
||||
|
||||
def parallelize_with_progress(scope)
|
||||
if options[:concurrency] < 1
|
||||
say('Cannot run with this concurrency setting, must be at least 1', :red)
|
||||
exit(1)
|
||||
end
|
||||
|
||||
db_config = ActiveRecord::Base.configurations[Rails.env].dup
|
||||
db_config['pool'] = options[:concurrency] + 1
|
||||
ActiveRecord::Base.establish_connection(db_config)
|
||||
reset_connection_pools!
|
||||
|
||||
progress = create_progress_bar(scope.count)
|
||||
pool = Concurrent::FixedThreadPool.new(options[:concurrency])
|
||||
@@ -52,6 +55,9 @@ module Mastodon
|
||||
|
||||
result = ActiveRecord::Base.connection_pool.with_connection do
|
||||
yield(item)
|
||||
ensure
|
||||
RedisConfiguration.pool.checkin if Thread.current[:redis]
|
||||
Thread.current[:redis] = nil
|
||||
end
|
||||
|
||||
aggregate.increment(result) if result.is_a?(Integer)
|
||||
|
||||
@@ -19,7 +19,7 @@ class Mastodon::RackMiddleware
|
||||
end
|
||||
|
||||
def clean_up_redis_socket!
|
||||
Thread.current[:redis]&.close
|
||||
RedisConfiguration.pool.checkin if Thread.current[:redis]
|
||||
Thread.current[:redis] = nil
|
||||
end
|
||||
|
||||
|
||||
@@ -59,9 +59,7 @@ module Mastodon
|
||||
index.specification.lock!
|
||||
end
|
||||
|
||||
db_config = ActiveRecord::Base.configurations[Rails.env].dup
|
||||
db_config['pool'] = options[:concurrency] + 1
|
||||
ActiveRecord::Base.establish_connection(db_config)
|
||||
reset_connection_pools!
|
||||
|
||||
pool = Concurrent::FixedThreadPool.new(options[:concurrency])
|
||||
added = Concurrent::AtomicFixnum.new(0)
|
||||
@@ -139,6 +137,9 @@ module Mastodon
|
||||
sleep 1
|
||||
rescue => e
|
||||
progress.log pastel.red("Error importing #{index}: #{e}")
|
||||
ensure
|
||||
RedisConfiguration.pool.checkin if Thread.current[:redis]
|
||||
Thread.current[:redis] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ class Mastodon::SidekiqMiddleware
|
||||
end
|
||||
|
||||
def clean_up_redis_socket!
|
||||
Thread.current[:redis]&.close
|
||||
RedisConfiguration.pool.checkin if Thread.current[:redis]
|
||||
Thread.current[:redis] = nil
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
def gen_border(codepoint)
|
||||
def gen_border(codepoint, color)
|
||||
input = Rails.root.join('public', 'emoji', "#{codepoint}.svg")
|
||||
dest = Rails.root.join('public', 'emoji', "#{codepoint}_border.svg")
|
||||
doc = File.open(input) { |f| Nokogiri::XML(f) }
|
||||
@@ -19,7 +19,7 @@ def gen_border(codepoint)
|
||||
|
||||
border_elem.delete('fill')
|
||||
|
||||
border_elem['stroke'] = 'white'
|
||||
border_elem['stroke'] = color
|
||||
border_elem['stroke-linejoin'] = 'round'
|
||||
border_elem['stroke-width'] = '4px'
|
||||
|
||||
@@ -91,12 +91,16 @@ namespace :emojis do
|
||||
desc 'Generate emoji variants with white borders'
|
||||
task :generate_borders do
|
||||
src = Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_map.json')
|
||||
emojis = '🎱🐜⚫🖤⬛◼️◾◼️✒️▪️💣🎳📷📸♣️🕶️✴️🔌💂♀️📽️🍳🦍💂🔪🕳️🕹️🕋🖊️🖋️💂♂️🎤🎓🎥🎼♠️🎩🦃📼📹🎮🐃🏴🐞🕺📱📲🚲👽⚾🐔☁️💨🕊️👀🍥👻🐐❕❔⛸️🌩️🔊🔇📃🌧️🐏🍚🍙🐓🐑💀☠️🌨️🔉🔈💬💭🏐🏳️⚪⬜◽◻️▫️'
|
||||
emojis_light = '👽⚾🐔☁️💨🕊️👀🍥👻🐐❕❔⛸️🌩️🔊🔇📃🌧️🐏🍚🍙🐓🐑💀☠️🌨️🔉🔈💬💭🏐🏳️⚪⬜◽◻️▫️'
|
||||
emojis_dark = '🎱🐜⚫🖤⬛◼️◾◼️✒️▪️💣🎳📷📸♣️🕶️✴️🔌💂♀️📽️🍳🦍💂🔪🕳️🕹️🕋🖊️🖋️💂♂️🎤🎓🎥🎼♠️🎩🦃📼📹🎮🐃🏴🐞🕺📱📲🚲'
|
||||
|
||||
map = Oj.load(File.read(src))
|
||||
|
||||
emojis.each_grapheme_cluster do |emoji|
|
||||
gen_border map[emoji]
|
||||
emojis_light.each_grapheme_cluster do |emoji|
|
||||
gen_border map[emoji], 'black'
|
||||
end
|
||||
emojis_dark.each_grapheme_cluster do |emoji|
|
||||
gen_border map[emoji], 'white'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user