Source code for the custom Mastodon (Glitchsoc) instance on berserker.town.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
633 B

# frozen_string_literal: true
module Chewy
class Strategy
class Mastodon < Base
def initialize
super
@stash = Hash.new { |hash, key| hash[key] = [] }
end
def update(type, objects, _options = {})
@stash[type].concat(type.root.id ? Array.wrap(objects) : type.adapter.identify(objects)) if Chewy.enabled?
end
def leave
RedisConfiguration.with do |redis|
redis.pipelined do |pipeline|
@stash.each do |type, ids|
pipeline.sadd("chewy:queue:#{type.name}", ids)
end
end
end
end
end
end
end