Currently, our release_episodes logic does a comparison of episode published_at vs created_at, to determine what needs to be released on the 5-minute background cron.
This is maybe a bit brittle? And doesn't work when you consider multiple feeds being published with different episode offsets.
So instead - this uses some SQL to figure out all the timestamps every episode should publish at (joining episodes to feeds.episode_offset_seconds). And figures out the latest publishing_queue_item.created_at we've kicked off for that podcast_id. If we don't have a publishing queue >= the timestamp the episode drops ... create one!
Closes #955.
Currently, our
release_episodes
logic does a comparison of episodepublished_at
vscreated_at
, to determine what needs to be released on the 5-minute background cron.This is maybe a bit brittle? And doesn't work when you consider multiple feeds being published with different episode offsets.
So instead - this uses some SQL to figure out all the timestamps every episode should publish at (joining
episodes
tofeeds.episode_offset_seconds
). And figures out the latestpublishing_queue_item.created_at
we've kicked off for that podcast_id. If we don't have a publishing queue >= the timestamp the episode drops ... create one!