Add context timeouts for third-party requests
Some checks failed
/ golint (push) Failing after 3m56s

Avoid hanging a goroutine for a long time.
This commit is contained in:
Eli Ribble 2026-05-19 00:24:16 +00:00
parent 2093ea74c4
commit 15d8966971
No known key found for this signature in database
11 changed files with 80 additions and 5 deletions

View file

@ -3,6 +3,7 @@ package email
import (
"context"
"fmt"
"time"
"github.com/Gleipnir-Technology/nidus-sync/config"
"github.com/rs/zerolog/log"
@ -69,6 +70,9 @@ type emailResponse struct {
var FORWARDEMAIL_EMAIL_POST_API = "https://api.forwardemail.net/v1/emails"
func Send(ctx context.Context, email Request) (result emailResponse, err error) {
ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
defer cancel()
client := resty.New()
var err_resp emailResponseError