Add retry for publish
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package streams
|
package streams
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
func (s *Stream) Publish(url string) error {
|
func (s *Stream) Publish(url string) error {
|
||||||
cons, run, err := GetConsumer(url)
|
cons, run, err := GetConsumer(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -13,6 +15,10 @@ func (s *Stream) Publish(url string) error {
|
|||||||
go func() {
|
go func() {
|
||||||
run()
|
run()
|
||||||
s.RemoveConsumer(cons)
|
s.RemoveConsumer(cons)
|
||||||
|
|
||||||
|
// TODO: more smart retry
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
_ = s.Publish(url)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user