From 36b9ddc80f898ad4e79bd0b398db2193588a54d1 Mon Sep 17 00:00:00 2001 From: Antoine Aflalo <197810+Belphemur@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:31:31 -0400 Subject: [PATCH] fix(webp): fix issue with concurrent preparation of encoder. --- pkg/converter/webp/webp_provider.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/converter/webp/webp_provider.go b/pkg/converter/webp/webp_provider.go index a191cc3..00f5844 100644 --- a/pkg/converter/webp/webp_provider.go +++ b/pkg/converter/webp/webp_provider.go @@ -4,11 +4,16 @@ import ( "github.com/belphemur/go-webpbin/v2" "image" "io" + "sync" ) const libwebpVersion = "1.6.0" +var prepareMutex sync.Mutex + func PrepareEncoder() error { + prepareMutex.Lock() + defer prepareMutex.Unlock() webpbin.SetLibVersion(libwebpVersion) container := webpbin.NewCWebP() return container.BinWrapper.Run()