Skip to content

Commit da50fdd

Browse files
committed
Allow publish to succeed after server restart
1 parent a6a0cfb commit da50fdd

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/jobs/publish_job.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,13 @@ impl JobInstance for PublishJobInstance {
198198
current_build.published_state,
199199
&current_build.published_state_reason,
200200
);
201-
if !current_published_state.same_state_as(&PublishedState::Publishing) {
202-
// Something weird was happening, we expected this build to be in the publishing state
201+
let is_restart_recovery = res.is_ok()
202+
&& current_published_state
203+
== PublishedState::Failed("Server was restarted during publish".to_string());
204+
205+
if !current_published_state.same_state_as(&PublishedState::Publishing)
206+
&& !is_restart_recovery
207+
{
203208
error!("Unexpected publishing state {:?}", current_published_state);
204209
return Err(DieselError::RollbackTransaction);
205210
};

0 commit comments

Comments
 (0)