Skip to content
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

refactor: don't crash when failing to release slot #536

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions deployer/src/deployment/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use opentelemetry::global;
use serde_json::json;
use shuttle_service::loader::{build_crate, get_config};
use tokio::time::{sleep, timeout};
use tracing::{debug, debug_span, error, info, instrument, trace, Instrument, Span};
use tracing::{debug, debug_span, error, info, instrument, trace, warn, Instrument, Span};
use tracing_opentelemetry::OpenTelemetrySpanExt;
use uuid::Uuid;

Expand Down Expand Up @@ -78,10 +78,7 @@ pub async fn task(
Err(err) => build_failed(&id, err),
}

match remove_from_queue(queue_client, id).await {
Ok(_) => {}
Err(err) => build_failed(&id, err),
}
remove_from_queue(queue_client, id).await
}
.instrument(span)
.await
Expand Down Expand Up @@ -114,10 +111,14 @@ async fn wait_for_queue(queue_client: impl BuildQueueClient, id: Uuid) -> Result
Ok(())
}

async fn remove_from_queue(queue_client: impl BuildQueueClient, id: Uuid) -> Result<()> {
queue_client.release_slot(id).await?;

Ok(())
async fn remove_from_queue(queue_client: impl BuildQueueClient, id: Uuid) {
match queue_client.release_slot(id).await {
Ok(_) => {}
Err(error) => warn!(
error = &error as &dyn std::error::Error,
"could not release build slot"
),
}
}

#[instrument(fields(id = %built.id, state = %State::Built))]
Expand Down