chore: better config
/ publish (push) Successful in 3m1s

This commit is contained in:
2026-03-07 20:55:04 +01:00
parent fca1030e1a
commit eab7eb3879
5 changed files with 24 additions and 4 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ func (s *Service) GetImage(ctx context.Context, uid string, options Options) (im
outBuff := bytes.NewBuffer(make([]byte, 0, 1024))
if options.Quality == 0 {
options.Quality = 80
options.Quality = s.cfg.Quality
}
err = jpeg.Encode(outBuff, decImage, &jpeg.Options{Quality: options.Quality})
+5 -2
View File
@@ -3,6 +3,7 @@ package images
import (
"os"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/config"
"github.com/valkey-io/valkey-go"
"golang.org/x/sync/semaphore"
)
@@ -17,13 +18,15 @@ type Service struct {
fs fileSystem
cache valkey.Client
seph *semaphore.Weighted
cfg *config.ImageConfig
}
func New(fs fileSystem, cache valkey.Client, maxConcurency int64) *Service {
func New(fs fileSystem, cfg *config.ImageConfig, cache valkey.Client) *Service {
return &Service{
fs: fs,
cache: cache,
seph: semaphore.NewWeighted(maxConcurency),
seph: semaphore.NewWeighted(cfg.Concurency),
cfg: cfg,
}
}