Skip to content

Commit

Permalink
fix(exif): Using flushing cache method when updating exif
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Aug 8, 2022
1 parent d087628 commit 64454f2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion infra/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ spec:
FIBR_EXIF_URL: http://exas
FIBR_IGNORE_PATTERN: '.st(folder|ignore)'
FIBR_LOGGER_JSON: 'true'
FIBR_LOGGER_LEVEL: 'DEBUG'
FIBR_PUBLIC_URL: https://fibr.vibioh.fr
FIBR_REDIS_ADDRESS: 'redis:80'
FIBR_SANITIZE_ON_START: 'true'
Expand Down
2 changes: 1 addition & 1 deletion pkg/exif/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (a App) computeAndSaveAggregate(ctx context.Context, dir absto.Item) error
return nil
}

return a.saveMetadata(ctx, dir, provider.Aggregate{
return a.SaveAggregateFor(ctx, dir, provider.Aggregate{
Location: directoryAggregate.value(),
Start: minDate,
End: maxDate,
Expand Down
4 changes: 2 additions & 2 deletions pkg/exif/amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (a App) AmqpHandler(message amqp.Delivery) error {
}

if resp.Exif.IsZero() {
logger.Debug("[exif] [handler] %s: no exif", resp.Item.Pathname)
logger.WithField("item", resp.Item.Pathname).Debug("no exif")
return nil
}

Expand All @@ -33,7 +33,7 @@ func (a App) AmqpHandler(message amqp.Delivery) error {

resp.Exif.Description = exif.Description

if err := a.saveMetadata(ctx, resp.Item, resp.Exif); err != nil {
if err := a.SaveExifFor(ctx, resp.Item, resp.Exif); err != nil {
return fmt.Errorf("save: %s", err)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/exif/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (a App) handleStartEvent(ctx context.Context, event provider.Event) error {

item := event.Item
if !forced && a.hasMetadata(ctx, item) {
logger.Debug("[exif] [start] %s: has metadata and not forced", item.Pathname)
logger.WithField("item", item.Pathname).Debug("has metadata")
return nil
}

Expand All @@ -80,7 +80,7 @@ func (a App) handleStartEvent(ctx context.Context, event provider.Event) error {

func (a App) handleUploadEvent(ctx context.Context, item absto.Item, aggregate bool) error {
if !a.CanHaveExif(item) {
logger.Debug("[exif] [upload] %s: can't have exif", item.Pathname)
logger.WithField("item", item.Pathname).Debug("can't have exif")
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/exif/exif.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ func (a App) extractAndSaveExif(ctx context.Context, item absto.Item) (exif exas
exif.Description = previousExif.Description

if exif.IsZero() {
logger.Debug("[exif] [save] %s: no exif", item.Pathname)
logger.WithField("item", item.Pathname).Debug("no exif")
return
}

if err = a.saveMetadata(ctx, item, exif); err != nil {
if err = a.SaveExifFor(ctx, item, exif); err != nil {
err = fmt.Errorf("save exif: %s", err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/thumbnail/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (a App) shouldGenerateStream(ctx context.Context, item absto.Item) (bool, e
return false, fmt.Errorf("discard body: %s", err)
}

logger.WithField("item", item.Pathname).Debug("Bitrate is %s", bitrate)
logger.WithField("item", item.Pathname).Debug("Bitrate is %d", bitrate)

return bitrate >= a.minBitrate, nil
}
Expand Down

0 comments on commit 64454f2

Please sign in to comment.