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

fix(scaler): always publish delete notification #234

Merged
merged 1 commit into from
Jan 12, 2024
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
8 changes: 5 additions & 3 deletions src/scaler/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,12 @@ where
#[instrument(level = "debug", skip(self), fields(lattice_id = %self.lattice_id))]
pub async fn remove_scalers(&self, name: &str) -> Option<Result<()>> {
let scalers = match self.remove_scalers_internal(name).await {
Some(Ok(s)) => s,
Some(Ok(s)) => Some(s),
Some(Err(e)) => {
warn!(err = ?e, "Error when running cleanup steps for scalers. Operation will be retried");
return Some(Err(e));
}
None => return None,
None => None,
};

// SAFETY: This is entirely data in our control and should be safe to unwrap
Expand All @@ -360,7 +360,9 @@ where
.await
{
error!(error = %e, "Unable to publish notification");
self.scalers.write().await.insert(name.to_owned(), scalers);
if let Some(scalers) = scalers {
self.scalers.write().await.insert(name.to_owned(), scalers);
}
Some(Err(e))
} else {
Some(Ok(()))
Expand Down
Loading