fix: setting entities to done
This commit is contained in:
@@ -40,6 +40,19 @@ func (p *ImageProcessor) setImageToProcess(ctx context.Context, image model.Imag
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ImageProcessor) setImageToDone(ctx context.Context, image model.Image) {
|
||||
err := p.imageModel.UpdateProcess(ctx, image.ID, model.Progress_Complete)
|
||||
if err != nil {
|
||||
// TODO: what can we actually do here for the errors?
|
||||
// We can't stop the work for the others
|
||||
|
||||
p.logger.Error("failed to update image", "err", err)
|
||||
|
||||
// TODO: we can use context here to actually pass some information through
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ImageProcessor) describe(ctx context.Context, image model.Image) {
|
||||
descriptionSubLogger := p.logger.With("describe image", image.ID)
|
||||
|
||||
@@ -97,6 +110,8 @@ func (p *ImageProcessor) processImage(image model.Image) {
|
||||
|
||||
wg.Wait()
|
||||
|
||||
p.setImageToDone(ctx, image)
|
||||
|
||||
// TODO: there is some repeated code here. The ergonomicts of the notifications,
|
||||
// isn't the best.
|
||||
imageNotification = notifications.GetImageNotification(notifications.ImageNotification{
|
||||
|
||||
@@ -45,6 +45,19 @@ func (p *StackProcessor) setStackToProcess(ctx context.Context, stack model.Stac
|
||||
}
|
||||
}
|
||||
|
||||
func (p *StackProcessor) setStackToDone(ctx context.Context, stack model.Stacks) {
|
||||
err := p.stackModel.UpdateProcess(ctx, stack.ID, model.Progress_Complete)
|
||||
if err != nil {
|
||||
// TODO: what can we actually do here for the errors?
|
||||
// We can't stop the work for the others
|
||||
|
||||
p.logger.Error("failed to update stack", "err", err)
|
||||
|
||||
// TODO: we can use context here to actually pass some information through
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (p *StackProcessor) extractInfo(ctx context.Context, stack model.Stacks) {
|
||||
err := p.stackAgent.CreateList(p.logger, stack.UserID, stack.ID, stack.Name, stack.Description)
|
||||
if err != nil {
|
||||
@@ -87,6 +100,8 @@ func (p *StackProcessor) processImage(stack model.Stacks) {
|
||||
|
||||
wg.Wait()
|
||||
|
||||
p.setStackToDone(ctx, stack)
|
||||
|
||||
// TODO: there is some repeated code here. The ergonomicts of the notifications,
|
||||
// isn't the best.
|
||||
stackNotification = notifications.GetStackNotification(notifications.StackNotification{
|
||||
|
||||
Reference in New Issue
Block a user