feat(slack): add timeout

This commit is contained in:
Kevin Franklin Kim 2024-01-24 15:20:56 +01:00
parent 9184e09916
commit 1cf6500352
No known key found for this signature in database

View File

@ -3,6 +3,7 @@ package slack
import ( import (
"context" "context"
"fmt" "fmt"
"time"
"github.com/foomo/posh-providers/onepassword" "github.com/foomo/posh-providers/onepassword"
"github.com/foomo/posh/pkg/log" "github.com/foomo/posh/pkg/log"
@ -130,6 +131,8 @@ func (s *Slack) SendETCDUpdateMessage(ctx context.Context, cluster string) error
} }
func (s *Slack) Send(ctx context.Context, channel string, opts ...slack.MsgOption) error { func (s *Slack) Send(ctx context.Context, channel string, opts ...slack.MsgOption) error {
ctx, cancel := context.WithTimeout(ctx, time.Second*10)
defer cancel()
client, err := s.Client(ctx) client, err := s.Client(ctx)
if err != nil { if err != nil {
return err return err