diff --git a/internal/service/bouncer.go b/internal/service/bouncer.go index bf63259..5313000 100644 --- a/internal/service/bouncer.go +++ b/internal/service/bouncer.go @@ -17,13 +17,7 @@ func (b *Bouncer) Check(ctx context.Context, endpoint, dialed string) model.Boun Allow: false, } - tx, err := b.Begin(ctx) - if err != nil { - slog.Error("Unable to start transaction", slog.String("reason", err.Error())) - return result - } - - queries := sqlc.New(tx) + queries := sqlc.New(b.Cursor) row, err := queries.GetEndpointByExtension(ctx, sqlc.GetEndpointByExtensionParams{ ID: endpoint, Extension: db.Text(dialed), diff --git a/internal/service/endpoint.go b/internal/service/endpoint.go index ae80883..4c55195 100644 --- a/internal/service/endpoint.go +++ b/internal/service/endpoint.go @@ -156,6 +156,7 @@ func (e *EndpointService) Update(ctx context.Context, sid int32, payload model.P if err != nil { return model.Endpoint{}, err } + defer tx.Rollback(ctx) queries := sqlc.New(tx) endpoint, err := queries.GetEndpointByID(ctx, sid)