Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
spawn http client with conn. handler
Browse files Browse the repository at this point in the history
  • Loading branch information
AnatoleAM committed Dec 15, 2023
1 parent 38162c7 commit 516060d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ env:
jobs:
ci:
name: EventAPI Lint & Build
runs-on: aws-runner
runs-on: seventv
env:
GOLANGCI_LINT_CACHE: /home/runner/.cache/golangci-lint
concurrency:
Expand Down
10 changes: 7 additions & 3 deletions internal/app/connection/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import (
)

func NewHandler(conn Connection) Handler {
return handler{conn}
return handler{
conn: conn,
httpClient: http.Client{},
}
}

type Handler interface {
Expand All @@ -28,7 +31,8 @@ type Handler interface {
}

type handler struct {
conn Connection
conn Connection
httpClient http.Client
}

const (
Expand Down Expand Up @@ -351,7 +355,7 @@ func (h handler) OnBridge(gctx global.Context, m events.Message[json.RawMessage]
return err
}

res, err := http.DefaultClient.Post(gctx.Config().API.BridgeURL, "application/json", bytes.NewReader(b))
res, err := h.httpClient.Post(gctx.Config().API.BridgeURL, "application/json", bytes.NewReader(b))
if err != nil {
zap.S().Errorw("failed to bridge event", "error", err)

Expand Down

0 comments on commit 516060d

Please sign in to comment.