Add configurable timeouts and cache validity to ESI and SSO components
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go-eve-pi/options"
|
||||
|
||||
logger "git.site.quack-lab.dev/dave/cylogger"
|
||||
)
|
||||
|
||||
@@ -23,12 +25,19 @@ type ZulipWebhook struct {
|
||||
func NewZulipWebhook(url, email, token string) *ZulipWebhook {
|
||||
logger.Info("Zulip webhook client initialized with email: %s", email)
|
||||
|
||||
// Parse HTTP timeout ONCE at initialization
|
||||
httpTimeout, err := time.ParseDuration(options.GlobalOptions.HTTPTimeout)
|
||||
if err != nil {
|
||||
logger.Warning("Invalid HTTP timeout duration %s, using 30s default: %v", options.GlobalOptions.HTTPTimeout, err)
|
||||
httpTimeout = 30 * time.Second
|
||||
}
|
||||
|
||||
return &ZulipWebhook{
|
||||
url: url,
|
||||
email: email,
|
||||
token: token,
|
||||
client: &http.Client{
|
||||
Timeout: 30 * time.Second,
|
||||
Timeout: httpTimeout,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user