mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 00:13:46 +01:00
Update Scenes' 'Updated At' Date on Heatmap Gen & Expand Error Log (#5401)
* Update Scenes' 'Updated At' Date on Heatmap Gen & Expand Error Log The UpdatedAt field of a scene is now correctly updated after Generate Task is run and a heatmap linked to a scene.. I thought it made more sense here in the generate heatmap compared to scan.go, owing to funscript data not being tracked/stored in a typical sense with the scan message "updating metadata". I used a simplified error messaging as I did not think it was critcal but I do not know if did not use the correct code structure If updating the UpdatedAt field should be done there when the file is marked as interactive I can try and do that? This would fix this long-standing issue https://github.com/stashapp/stash/issues/3738 The error message change is useful as I could not tell which scripts were causing errors before but now it is clear in the logs * Use single transaction --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
parent
7fb8f9172e
commit
1b7e729750
1 changed files with 11 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
@ -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())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue