-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fix batch replay #4108
Fix batch replay #4108
Conversation
Replay complete testing and reset to pending both used a different means of making the payload than registering a new entry.
|
lib/avalon/batch/ingest.rb
Outdated
|
||
# Case 1, if there is a payload change and the item never completed, reset to pending | ||
# Also reset to pending if there is an error | ||
reset_to_pending(previous_entry, entry) if !previous_entry.complete || previous_entry.error | ||
|
||
# Case 2, if there is a published media object we cannot replay | ||
unless previous_entry.media_object_pid.nil? | ||
mo = MediaObject.find(previous_entry.media_object_pid) | ||
mo = MediaObject.find(previous_entry.media_object_pid) if MediaObject.exists?(previous_entry.media_object_pid) |
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.
I added this guard to avoid a NotFoundError which would have broken the whole batch registration process, but now I'm thinking that this should be handled in a separate PR since it might include more code changes and need a test.
I would think that if the batch entry has a media object id but the media object can't be found then the batch entry should probably be reset_to_pending so that it will be recreated. @joncameron Do you have an opinion on this?
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.
I went ahead and removed it so this PR can go ahead and be merged, but I think it would be good to create a follow-up issue or PR so it doesn't get lost.
Replay complete testing and reset to pending both used a different means of making the payload than registering a new entry.
Fixes #4109 .