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

Update Scenes' 'Updated At' Date on Heatmap Gen & Expand Error Log #5401

Merged
merged 2 commits into from
Oct 29, 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
14 changes: 11 additions & 3 deletions internal/manager/task_generate_interactive_heatmap_speed.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (t *GenerateInteractiveHeatmapSpeedTask) Start(ctx context.Context) {
err := generator.Generate(funscriptPath, heatmapPath, t.Scene.Files.Primary().Duration)

if err != nil {
logger.Errorf("error generating heatmap: %s", err.Error())
logger.Errorf("error generating heatmap for %s: %s", t.Scene.Path, err.Error())
return
}

Expand All @@ -46,8 +46,16 @@ func (t *GenerateInteractiveHeatmapSpeedTask) Start(ctx context.Context) {
if err := r.WithTxn(ctx, func(ctx context.Context) error {
primaryFile := t.Scene.Files.Primary()
primaryFile.InteractiveSpeed = &median
qb := r.File
return qb.Update(ctx, primaryFile)
if err := r.File.Update(ctx, primaryFile); err != nil {
return fmt.Errorf("updating interactive speed for %s: %w", primaryFile.Path, err)
}

// update the scene UpdatedAt field
// NewScenePartial sets the UpdatedAt field to the current time
if _, err := r.Scene.UpdatePartial(ctx, t.Scene.ID, models.NewScenePartial()); err != nil {
return fmt.Errorf("updating UpdatedAt field for scene %d: %w", t.Scene.ID, err)
}
return nil
}); err != nil && ctx.Err() == nil {
logger.Error(err.Error())
}
Expand Down
Loading