File tree Expand file tree Collapse file tree 5 files changed +11
-8
lines changed
Expand file tree Collapse file tree 5 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,10 @@ func main() {
5353
5454 eventPolling .PollEventsUntilEmpty ()
5555 go func () {
56- for {
57- select {
58- case event := <- channel :
59- log .Info ().Msgf ("Received event: %s" , event )
60- eventPolling .PollEventsUntilEmpty ()
61- }
56+ for event := range channel {
57+ log .Info ().Msgf ("Received event: %s" , event )
58+ eventPolling .PollEventsUntilEmpty ()
59+ log .Debug ().Msg ("New event received finished" )
6260 }
6361 }()
6462 h .Start ()
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module github.com/PRYVT/posting
33go 1.23.1
44
55require (
6- github.com/L4B0MB4/EVTSRC v0.5.2 // indirect
6+ github.com/L4B0MB4/EVTSRC v0.5.4 // indirect
77 github.com/PRYVT/utils v0.3.0-rc // indirect
88 github.com/bytedance/sonic v1.12.2 // indirect
99 github.com/bytedance/sonic/loader v0.2.0 // indirect
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ github.com/L4B0MB4/EVTSRC v0.5.1 h1:EB/lK0FTWtepToOtRFJdUhBf6tlb1L0bIRbRTMwArsQ=
44github.com/L4B0MB4/EVTSRC v0.5.1 /go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0 =
55github.com/L4B0MB4/EVTSRC v0.5.2 h1:bAOYlUmcZ2bg8rWIKnHLnxZPgXrPYyrQbtlz49BKlp4 =
66github.com/L4B0MB4/EVTSRC v0.5.2 /go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0 =
7+ github.com/L4B0MB4/EVTSRC v0.5.4 h1:bTg1PS78YzWb+dt3JJRFFVNMubIAiKJlO3Ivdy7jagc =
8+ github.com/L4B0MB4/EVTSRC v0.5.4 /go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0 =
79github.com/PRYVT/utils v0.1.2 h1:U9qhq+18iIblQDrM4I0fmJkvlZ+BCY+DIjjKI4ebtlk =
810github.com/PRYVT/utils v0.1.2 /go.mod h1:b7zk2FAGwJ8BPJx2JQ8qd+bA59g5EY7Y1vZQPWZHK3s =
911github.com/PRYVT/utils v0.2.0 h1:hWdHchXlGOYlJ1nfMmGffq/EjFn3ncvzTgsGCLUpiEE =
Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ func removeDisconnectedSockets(slice []*ws.WebsocketConnection) []*ws.WebsocketC
4141}
4242
4343func (eh * PostEventHandler ) HandleEvent (event models.Event ) error {
44+ log .Debug ().Msg ("Handling event" )
4445 if event .AggregateType == "post" {
46+ log .Debug ().Msg ("Handling post event" )
4547 ua , err := aggregates .NewPostAggregate (uuid .MustParse (event .AggregateId ))
4648 if err != nil {
4749 return err
@@ -64,7 +66,7 @@ func (eh *PostEventHandler) HandleEvent(event models.Event) error {
6466 eh .mu .Lock ()
6567 defer eh .mu .Unlock ()
6668 eh .wsConnections = removeDisconnectedSockets (eh .wsConnections )
67-
69+ log . Trace (). Msgf ( "Number of active connections: %d" , len ( eh . wsConnections ))
6870 }
6971 return nil
7072}
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ func (wC *WebsocketConnection) ReadForDisconnect() {
4545 wC .IsConnected = false
4646 break
4747 } else {
48+ log .Debug ().Interface ("authReq" , authRequest ).Msg ("Received auth request" )
4849 _ , err = auth .VerifyToken (authRequest .Token )
4950 if err != nil {
5051 log .Debug ().Err (err ).Msg ("Error while verifying token" )
You can’t perform that action at this time.
0 commit comments