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(maestro): fix deployment skipping on last status was error #2715

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 6 additions & 6 deletions maestro/deployment/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,25 @@ func (d *deploymentService) UpdateDeployment(ctx context.Context, deployment *De
if err != nil {
d.logger.Warn("could not stop running collector, will try to update anyway", zap.Error(err))
}
err = deployment.Merge(*got)
err = got.Merge(*deployment)
if err != nil {
d.logger.Error("error during merge of deployments", zap.Error(err))
return err
}
deployment.LastCollectorStopTime = &now
codedConfig, err := d.encodeConfig(deployment)
got.LastCollectorStopTime = &now
codedConfig, err := d.encodeConfig(got)
if err != nil {
return err
}
err = deployment.SetConfig(codedConfig)
err = got.SetConfig(codedConfig)
if err != nil {
return err
}
updated, err := d.dbRepository.Update(ctx, deployment)
updated, err := d.dbRepository.Update(ctx, got)
if err != nil {
return err
}
err = d.maestroProducer.PublishSinkStatus(ctx, deployment.OwnerID, deployment.SinkID, "unknown", "")
err = d.maestroProducer.PublishSinkStatus(ctx, updated.OwnerID, updated.SinkID, "unknown", "")
if err != nil {
return err
}
Expand Down
11 changes: 1 addition & 10 deletions maestro/service/deploy_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,14 @@ func (d *eventService) HandleSinkActivity(ctx context.Context, event maestroredi
return errors.New("trying to deploy sink that is not active")
}
d.logger.Debug("handling sink activity event", zap.String("sink-id", event.SinkID))
deploymentEntry, _, err := d.deploymentService.GetDeployment(ctx, event.OwnerID, event.SinkID)
lpegoraro marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
d.logger.Warn("did not find collector entry for sink", zap.String("sink-id", event.SinkID))
return err
}
if deploymentEntry.LastStatus == "error" {
d.logger.Warn("collector is in error state, skipping")
return nil
}
// async update sink status to provisioning
go func() {
err := d.deploymentService.UpdateStatus(ctx, event.OwnerID, event.SinkID, "provisioning", "")
if err != nil {
d.logger.Error("error updating status to provisioning", zap.Error(err))
}
}()
_, err = d.deploymentService.NotifyCollector(ctx, event.OwnerID, event.SinkID, "deploy", "", "")
_, err := d.deploymentService.NotifyCollector(ctx, event.OwnerID, event.SinkID, "deploy", "", "")
if err != nil {
d.logger.Error("error trying to notify collector", zap.Error(err))
err2 := d.deploymentService.UpdateStatus(ctx, event.OwnerID, event.SinkID, "provisioning_error", err.Error())
Expand Down