refac: removed 7 direct and 12 indirect go modules for custom code instead

This commit is contained in:
Florian Sylvain committed 2026-10-21 23:13:46 +02:00
1 parent cfcf108488
commit c68e9a7858
73 files changed
+2455 -428

No files matched your search

@@ -0,0 +1,45 @@
package useCases
import (
"RenewCMS/internal/domain/image"
"errors"
"sync"
)
var errFlightAbandoned = errors.New("shared call ended without a result")
type flightCall struct {
done chan struct{}
value image.VariantFile
err error
}
type flightGroup struct {
mu sync.Mutex
calls map[string]*flightCall
}
func (g *flightGroup) do(key string, work func() (image.VariantFile, error)) (image.VariantFile, error) {
g.mu.Lock()
if existing, running := g.calls[key]; running {
g.mu.Unlock()
<-existing.done
return existing.value, existing.err
}
if g.calls == nil {
g.calls = map[string]*flightCall{}
}
call := &flightCall{done: make(chan struct{}), err: errFlightAbandoned}
g.calls[key] = call
g.mu.Unlock()
defer func() {
g.mu.Lock()
delete(g.calls, key)
g.mu.Unlock()
close(call.done)
}()
call.value, call.err = work()
return call.value, call.err
}