pools: Add a pool for buffers

This commit is contained in:
Tom Wiesing 2023-01-24 11:04:34 +01:00
parent a63bb2f669
commit 598de5b289
No known key found for this signature in database
6 changed files with 56 additions and 28 deletions

View file

@ -9,6 +9,7 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/models"
"github.com/FAU-CDI/wisski-distillery/pkg/errorx"
"github.com/FAU-CDI/wisski-distillery/pkg/pools"
"github.com/FAU-CDI/wisski-distillery/pkg/unpack"
"github.com/tkw1536/goprogram/exit"
)
@ -38,8 +39,9 @@ func (ts *Triplestore) CreateRepository(ctx context.Context, name, domain, user,
}
// prepare the create repo request
var createRepo bytes.Buffer
err := unpack.WriteTemplate(&createRepo, map[string]string{
createRepo := pools.GetBuffer()
defer pools.ReleaseBuffer(createRepo)
err := unpack.WriteTemplate(createRepo, map[string]string{
"GRAPHDB_REPO": name,
"INSTANCE_DOMAIN": domain,
}, bytes.NewReader(createRepoTTL))