Prechádzať zdrojové kódy

set params in context

EUGENIO SOUZA CARVALHO 4 rokov pred
rodič
commit
bed13248e0
1 zmenil súbory, kde vykonal 8 pridanie a 1 odobranie
  1. 8 1
      api/sse/hub.go

+ 8 - 1
api/sse/hub.go

@@ -7,6 +7,7 @@ import (
 	"time"
 
 	"git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/api/errs"
+	"github.com/davecgh/go-spew/spew"
 	"github.com/gomodule/redigo/redis"
 	context "github.com/kataras/iris/v12/context"
 )
@@ -38,6 +39,12 @@ func (channel *Channel) AddClient(client *ChannelClient) {
 }
 
 func (channel *Channel) Emit(event *Event) {
+	defer func ()  {
+		if err := recover(); err != nil {
+			fmt.Printf("//--------------------\n%s\n-----------------//", err)
+			spew.Dump(err)
+		}
+	}()
 	for client := range channel.Clients {
 		if event.Kind != "" {
 			client.Context.Writef("event: %s\n", event.Kind)
@@ -235,7 +242,7 @@ func (hub *SSEHub) UpgradeConnection(ctx context.Context, channelId string) (err
 			select {
 			case <-ticker.C:
 				// ctx.Application().Logger().Warnf("init.notification.loop 2s")
-				flusher.Flush()
+				// flusher.Flush()
 
 			case <-finalizePing:
 				// ctx.Application().Logger().Warnf("finalize init.notification.loop 2s")