From 52e4bf1b35de9e241775b354749e49be5b4ffb9d Mon Sep 17 00:00:00 2001 From: Alex X Date: Wed, 11 Oct 2023 07:14:43 +0300 Subject: [PATCH] Add retry for publish --- internal/streams/publish.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/streams/publish.go b/internal/streams/publish.go index a352352b..a16dcec2 100644 --- a/internal/streams/publish.go +++ b/internal/streams/publish.go @@ -1,5 +1,7 @@ package streams +import "time" + func (s *Stream) Publish(url string) error { cons, run, err := GetConsumer(url) if err != nil { @@ -13,6 +15,10 @@ func (s *Stream) Publish(url string) error { go func() { run() s.RemoveConsumer(cons) + + // TODO: more smart retry + time.Sleep(5 * time.Second) + _ = s.Publish(url) }() return nil