Skip to content

Commit

Permalink
gonna need the account_id too
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomchak committed Nov 14, 2023
1 parent 129fda9 commit 4dc1d57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions app/lib/channel_feed_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ def batch_to_feed(channel_id, status_ids)

# Adds to Channels Feed, but only those filtered
# by the channels threshold
def batch_to_threshold(channel_id, status_ids)
statuses = status_ids.zip(status_ids)
# keeping both id and account_id of each status for breadcrumbs
# we serialize it to json to store
def batch_to_threshold(channel_id, statuses)
# statuses = status_ids.zip(status_ids)
batch_statuses = statuses.map { |s| [s[:id], s.to_json] }

perform_push_to_threshold(channel_id, statuses)
perform_push_to_threshold(channel_id, batch_statuses)
end

private
Expand All @@ -40,8 +43,6 @@ def perform_push_to_threshold(channel_id, statuses)

# Do the acutal adding to redis
def push(channel_key, statuses)
Rails.logger.debug { "PUSH TO REDIS: #{channel_key}" }
Rails.logger.debug { "PUSH TO REDIS: #{statuses.inspect}" }
redis.zadd(channel_key, statuses)
# Keep the list from growning infinitely
trim(channel_key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def update_engagement_threshold_channel_feeds!
filtered_channels = Mammoth::Channels.new.filter_statuses_with_threshold
filtered_channels.each do |channel|
Rails.logger.debug { "FILTER CHANNEL:: #{channel} \n" }
channel_feed_manager.batch_to_threshold(channel[:id], channel[:statuses].pluck('id'))
channel_feed_manager.batch_to_threshold(channel[:id], channel[:statuses].pluck(:id, :account_id))
end
end

Expand Down

0 comments on commit 4dc1d57

Please sign in to comment.