Template of a custom feed generator service for the Bluesky network in Ruby

added option to append to a feed

Changed files
+8 -3
+8 -3
Rakefile
··· 62 62 posts = Post.order('time, id').where("time > DATETIME('now', '-#{days} day')") 63 63 end 64 64 65 - puts "Cleaning up feed..." 66 - FeedPost.where(feed_id: feed.feed_id).delete_all 65 + if ENV['APPEND_ONLY'] 66 + current_post_ids = FeedPost.where(feed_id: feed.feed_id).pluck('post_id') 67 + else 68 + puts "Cleaning up feed..." 69 + FeedPost.where(feed_id: feed.feed_id).delete_all 70 + current_post_ids = [] 71 + end 67 72 68 73 total = posts.count 69 74 ··· 77 82 print "Processing posts... [#{offset + i + 1}/#{total}]\r" 78 83 $stdout.flush 79 84 80 - if feed.post_matches?(post) 85 + if !current_post_ids.include?(post.id) && feed.post_matches?(post) 81 86 FeedPost.create!(feed_id: feed.feed_id, post: post, time: post.time) 82 87 end 83 88 end