Skip to content

Commit

Permalink
chore(deps): Bumping deps
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Sep 10, 2022
1 parent b4efe74 commit d32e225
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 42 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module github.com/ViBiOh/fibr
go 1.19

require (
github.com/ViBiOh/ChatPotte v0.2.11
github.com/ViBiOh/ChatPotte v0.2.12
github.com/ViBiOh/absto v1.0.4
github.com/ViBiOh/auth/v2 v2.14.7
github.com/ViBiOh/auth/v2 v2.14.8
github.com/ViBiOh/exas v0.5.0
github.com/ViBiOh/flags v1.2.0
github.com/ViBiOh/httputils/v4 v4.47.6
github.com/ViBiOh/httputils/v4 v4.47.7
github.com/ViBiOh/vith v0.5.0
github.com/golang/mock v1.6.0
github.com/prometheus/client_golang v1.13.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ViBiOh/ChatPotte v0.2.11 h1:zMJidUjpqUMhZCJpWsbm0Sagc+soEIC82dBqdpWFA3I=
github.com/ViBiOh/ChatPotte v0.2.11/go.mod h1:LbGXtNVr5OMaL8DGxmos56Pkm4gJY8Qg95dt0ilWIc8=
github.com/ViBiOh/ChatPotte v0.2.12 h1:yTfvwdIc4Z6W0tNguZdYDhQQ4m1p1nU0Bl1PAgWGDhc=
github.com/ViBiOh/ChatPotte v0.2.12/go.mod h1:3jZhDFjhP0nUoA+HIIVeXadnMT30qQfnr+vExeOFPi0=
github.com/ViBiOh/absto v1.0.4 h1:j7GKLQzIyrCJUGU8Gvagse5wG5lLzJLNSSrMgVVDCnQ=
github.com/ViBiOh/absto v1.0.4/go.mod h1:+e6RyntSHivIJ3FwVL8jefGVvYkDBS5gZ5XvdqXRtT0=
github.com/ViBiOh/auth/v2 v2.14.7 h1:ljZEutGnEqA3xVXfXW7J1PuCX+4lgxRpqAo2IO6GnGM=
github.com/ViBiOh/auth/v2 v2.14.7/go.mod h1:W24m80U3TLWlMr0Jy72BZY0vfpvZhFnnzl16TlRmQig=
github.com/ViBiOh/auth/v2 v2.14.8 h1:ix26s+ZF44wrMdhLHWa6ozVH4YFLBKqgIvTIuzTmj98=
github.com/ViBiOh/auth/v2 v2.14.8/go.mod h1:KrjZ/s3ZijLIW5RdIt9KndTxQU8d1EWNTYiV81o/Brg=
github.com/ViBiOh/exas v0.5.0 h1:ZL5v5rUOkkwo6PxhbOVe96L0RUre7SfStaVcqhE/IbU=
github.com/ViBiOh/exas v0.5.0/go.mod h1:sKRV/vz85Vj0caT+a3XWVFp0gyzXe36eZWL+XKge93E=
github.com/ViBiOh/flags v1.2.0 h1:DaujjNXzD29KxKyp4eZdn7c9+uBN5DokWgDAe7DcUmc=
github.com/ViBiOh/flags v1.2.0/go.mod h1:UyMB5zeD/aId7Xw3x7577ZNU298JmukzOcV8p/H2W1s=
github.com/ViBiOh/httputils/v4 v4.47.6 h1:T0no0RjRpvYv80dTfb9OnsKr0LXFu65p2bCqRfYKHgU=
github.com/ViBiOh/httputils/v4 v4.47.6/go.mod h1:qMX3opWLo3TBnjIOL4L/IOgObQf0gGsH0uF40sYydu8=
github.com/ViBiOh/httputils/v4 v4.47.7 h1:gClQ+LkLfbUFo0FgXKR4yhid69SgM1m+6n5MD8a/3uE=
github.com/ViBiOh/httputils/v4 v4.47.7/go.mod h1:qMX3opWLo3TBnjIOL4L/IOgObQf0gGsH0uF40sYydu8=
github.com/ViBiOh/vith v0.5.0 h1:BpmjwWxd4NGmUJF12XpFOngK32539Lw3mvbMOaeOmhE=
github.com/ViBiOh/vith v0.5.0/go.mod h1:Wf40eedOBEcxeLzGzGpuO+2G8qe5Ov1WIIBPXohyKco=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
Expand Down
10 changes: 2 additions & 8 deletions pkg/exif/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ func (a App) ListExifFor(ctx context.Context, items ...absto.Item) (map[string]e
ctx, end := tracer.StartSpan(ctx, a.tracer, "list_exif")
defer end()

exifs, err := a.exifCacheApp.List(ctx, items...)
if err != nil {
return nil, err
}
exifs := a.exifCacheApp.List(ctx, onExifError, items...)

output := make(map[string]exas.Exif, len(items))
exifsLen := len(exifs)
Expand Down Expand Up @@ -70,10 +67,7 @@ func (a App) ListAggregateFor(ctx context.Context, items ...absto.Item) (map[str
ctx, end := tracer.StartSpan(ctx, a.tracer, "list_aggregate")
defer end()

exifs, err := a.aggregateCacheApp.List(ctx, items...)
if err != nil {
return nil, err
}
exifs := a.aggregateCacheApp.List(ctx, onAggregateError, items...)

output := make(map[string]provider.Aggregate, len(items))
exifsLen := len(exifs)
Expand Down
24 changes: 24 additions & 0 deletions pkg/exif/error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package exif

import (
"errors"

absto "github.com/ViBiOh/absto/pkg/model"
"github.com/ViBiOh/httputils/v4/pkg/logger"
)

func onExifError(item absto.Item, err error) bool {
if !absto.IsNotExist(err) && !errors.Is(err, errInvalidItemType) {
logger.WithField("item", item.Pathname).Error("load exif: %s", item.Pathname, err)
}

return true
}

func onAggregateError(item absto.Item, err error) bool {
if !absto.IsNotExist(err) && !errors.Is(err, errInvalidItemType) {
logger.WithField("item", item.Pathname).Error("load exif: %s", item.Pathname, err)
}

return true
}
12 changes: 0 additions & 12 deletions pkg/exif/exif.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ func New(config Config, storageApp absto.Storage, prometheusRegisterer prometheu
}

return app.loadExif(ctx, item)
}, func(item absto.Item, err error) {
if absto.IsNotExist(err) || errors.Is(err, errInvalidItemType) {
return
}

logger.WithField("item", item.Pathname).Error("load exif: %s", item.Pathname, err)
}, cacheDuration, provider.MaxConcurrency, tracerApp.GetTracer("exif_cache"))

app.aggregateCacheApp = cache.New(redisClient, redisKey, func(ctx context.Context, item absto.Item) (provider.Aggregate, error) {
Expand All @@ -124,12 +118,6 @@ func New(config Config, storageApp absto.Storage, prometheusRegisterer prometheu
}

return app.loadAggregate(ctx, item)
}, func(item absto.Item, err error) {
if absto.IsNotExist(err) || errors.Is(err, errInvalidItemType) {
return
}

logger.WithField("item", item.Pathname).Error("load exif: %s", item.Pathname, err)
}, cacheDuration, provider.MaxConcurrency, tracerApp.GetTracer("ggregate_cache"))

return app, nil
Expand Down
14 changes: 14 additions & 0 deletions pkg/thumbnail/error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package thumbnail

import (
absto "github.com/ViBiOh/absto/pkg/model"
"github.com/ViBiOh/httputils/v4/pkg/logger"
)

func onCacheError(pathname string, err error) bool {
if !absto.IsNotExist(err) {
logger.WithField("item", pathname).Error("get info: %s", pathname, err)
}

return false
}
13 changes: 1 addition & 12 deletions pkg/thumbnail/thumbnail.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ func New(config Config, storage absto.Storage, redisClient redis.App, prometheus

app.cacheApp = cache.New(redisClient, redisKey, func(ctx context.Context, pathname string) (absto.Item, error) {
return app.storageApp.Info(ctx, pathname)
}, func(pathname string, err error) {
if absto.IsNotExist(err) {
return
}

logger.WithField("item", pathname).Error("get info: %s", pathname, err)
}, redisCacheDuration, provider.MaxConcurrency, tracerApp.GetTracer("thumbnail_cache"))

return app, nil
Expand Down Expand Up @@ -265,14 +259,9 @@ func (a App) thumbnailHash(ctx context.Context, items []absto.Item) string {
ids[index] = a.PathForScale(item, SmallSize)
}

thumbnails, err := a.cacheApp.List(ctx, ids...)
if err != nil {
logger.Error("list thumbnail hash: %s", err)
}

hasher := sha.Stream()

for _, thumbnail := range thumbnails {
for _, thumbnail := range a.cacheApp.List(ctx, onCacheError, ids...) {
hasher.Write(thumbnail)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/thumbnail/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestHasThumbnail(t *testing.T) {
storageMock := mocks.NewStorage(ctrl)

tc.instance.storageApp = storageMock
tc.instance.cacheApp = cache.New(nil, nil, storageMock.Info, nil, 0, 0, nil)
tc.instance.cacheApp = cache.New(nil, nil, storageMock.Info, 0, 0, nil)

if intention == "found" {
storageMock.EXPECT().Info(gomock.Any(), gomock.Any()).Return(absto.Item{}, nil)
Expand Down

0 comments on commit d32e225

Please sign in to comment.