-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retry on error_apple non-terminal error #1148
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
class PublishingPipelineState < ApplicationRecord | ||
TERMINAL_STATUSES = [:complete, :error, :expired].freeze | ||
TERMINAL_FAILURE_STATUSES = [:error, :expired].freeze | ||
FAILURE_STATUSES = [:error, :expired, :error_apple].freeze | ||
UNIQUE_STATUSES = TERMINAL_STATUSES + [:created, :started] | ||
|
||
# Handle the max timout for a publishing pipeline: Pub RSS job + Pub Apple job + a few extra minutes of flight | ||
|
@@ -19,7 +19,7 @@ class PublishingPipelineState < ApplicationRecord | |
scope :latest_failed_pipelines, -> { | ||
# Grab the latest attempted Publishing Item AND the latest failed Pub Item. | ||
# If that is a non-null intersection, then we have a current/latest+failed pipeline. | ||
where(publishing_queue_item_id: PublishingQueueItem.latest_attempted.latest_failed.select(:id)) | ||
where(publishing_queue_item_id: PublishingQueueItem.latest_attempted.latest_failed.order(id: :asc).select(:id)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that order(:id) appropriate to add to either the Also, why :asc? That means the latest will be at the end? Wouldn't the most recently failed make sense as the first? |
||
} | ||
|
||
scope :latest_by_queue_item, -> { | ||
|
@@ -173,8 +173,16 @@ def self.expire_pipelines! | |
end | ||
end | ||
|
||
def self.latest_failed_publishing_queue_items | ||
PublishingQueueItem.where(id: latest_failed_pipelines.select(:publishing_queue_item_id).distinct) | ||
end | ||
|
||
def self.latest_failed_podcasts | ||
Podcast.where(id: latest_failed_publishing_queue_items.select(:podcast_id).distinct) | ||
end | ||
|
||
def self.retry_failed_pipelines! | ||
Podcast.where(id: latest_failed_pipelines.select(:podcast_id).distinct).each do |podcast| | ||
latest_failed_podcasts.each do |podcast| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, nicer to have a method for this. |
||
Rails.logger.tagged("PublishingPipeLineState.retry_failed_pipelines!", "Podcast:#{podcast.id}") do | ||
start_pipeline!(podcast) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, makes sense to have this grouping