Skip to content

Commit d9f30dd

Browse files
authored
Merge pull request #3 from PRYVT/development
Development
2 parents 57a63e0 + cb3db95 commit d9f30dd

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

cmd/queryer/main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff 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()

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/PRYVT/posting
33
go 1.23.1
44

55
require (
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

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/L4B0MB4/EVTSRC v0.5.1 h1:EB/lK0FTWtepToOtRFJdUhBf6tlb1L0bIRbRTMwArsQ=
44
github.com/L4B0MB4/EVTSRC v0.5.1/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0=
55
github.com/L4B0MB4/EVTSRC v0.5.2 h1:bAOYlUmcZ2bg8rWIKnHLnxZPgXrPYyrQbtlz49BKlp4=
66
github.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=
79
github.com/PRYVT/utils v0.1.2 h1:U9qhq+18iIblQDrM4I0fmJkvlZ+BCY+DIjjKI4ebtlk=
810
github.com/PRYVT/utils v0.1.2/go.mod h1:b7zk2FAGwJ8BPJx2JQ8qd+bA59g5EY7Y1vZQPWZHK3s=
911
github.com/PRYVT/utils v0.2.0 h1:hWdHchXlGOYlJ1nfMmGffq/EjFn3ncvzTgsGCLUpiEE=

pkg/query/eventhandling/post.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ func removeDisconnectedSockets(slice []*ws.WebsocketConnection) []*ws.WebsocketC
4141
}
4242

4343
func (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
}

pkg/query/websocket/websocket_connection.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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")

0 commit comments

Comments
 (0)