feat(webhooks): add timeout config option
This commit is contained in:
parent
34a92b759e
commit
b38360c9a5
@ -392,6 +392,7 @@ func InitDefaultConfig() {
|
||||
DefaultSettingsOverdueTaskRemindersTime.setDefault("9:00")
|
||||
// Webhook
|
||||
WebhooksEnabled.setDefault(true)
|
||||
WebhooksTimeoutSeconds.setDefault(30)
|
||||
}
|
||||
|
||||
// InitConfig initializes the config, sets defaults etc.
|
||||
|
@ -162,7 +162,10 @@ func (w *Webhook) sendWebhookPayload(p *WebhookPayload) (err error) {
|
||||
|
||||
req.Header.Add("User-Agent", "Vikunja/"+version.Version)
|
||||
|
||||
_, err = http.DefaultClient.Do(req)
|
||||
client := http.DefaultClient
|
||||
client.Timeout = time.Duration(config.WebhooksTimeoutSeconds.GetInt()) * time.Second
|
||||
|
||||
_, err = client.Do(req)
|
||||
if err == nil {
|
||||
log.Debugf("Sent webhook payload for webhook %d for event %s", w.ID, p.EventName)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user