Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cmd/queryer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ func main() {

eventPolling.PollEventsUntilEmpty()
go func() {
for {
select {
case event := <-channel:
log.Info().Msgf("Received event: %s", event)
eventPolling.PollEventsUntilEmpty()
}
for event := range channel {
log.Info().Msgf("Received event: %s", event)
eventPolling.PollEventsUntilEmpty()
log.Debug().Msg("New event received finished")
}
}()
h.Start()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/PRYVT/posting
go 1.23.1

require (
github.com/L4B0MB4/EVTSRC v0.5.2 // indirect
github.com/L4B0MB4/EVTSRC v0.5.4 // indirect
github.com/PRYVT/utils v0.3.0-rc // indirect
github.com/bytedance/sonic v1.12.2 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/L4B0MB4/EVTSRC v0.5.1 h1:EB/lK0FTWtepToOtRFJdUhBf6tlb1L0bIRbRTMwArsQ=
github.com/L4B0MB4/EVTSRC v0.5.1/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0=
github.com/L4B0MB4/EVTSRC v0.5.2 h1:bAOYlUmcZ2bg8rWIKnHLnxZPgXrPYyrQbtlz49BKlp4=
github.com/L4B0MB4/EVTSRC v0.5.2/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0=
github.com/L4B0MB4/EVTSRC v0.5.4 h1:bTg1PS78YzWb+dt3JJRFFVNMubIAiKJlO3Ivdy7jagc=
github.com/L4B0MB4/EVTSRC v0.5.4/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0=
github.com/PRYVT/utils v0.1.2 h1:U9qhq+18iIblQDrM4I0fmJkvlZ+BCY+DIjjKI4ebtlk=
github.com/PRYVT/utils v0.1.2/go.mod h1:b7zk2FAGwJ8BPJx2JQ8qd+bA59g5EY7Y1vZQPWZHK3s=
github.com/PRYVT/utils v0.2.0 h1:hWdHchXlGOYlJ1nfMmGffq/EjFn3ncvzTgsGCLUpiEE=
Expand Down
4 changes: 3 additions & 1 deletion pkg/query/eventhandling/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func removeDisconnectedSockets(slice []*ws.WebsocketConnection) []*ws.WebsocketC
}

func (eh *PostEventHandler) HandleEvent(event models.Event) error {
log.Debug().Msg("Handling event")
if event.AggregateType == "post" {
log.Debug().Msg("Handling post event")
ua, err := aggregates.NewPostAggregate(uuid.MustParse(event.AggregateId))
if err != nil {
return err
Expand All @@ -64,7 +66,7 @@ func (eh *PostEventHandler) HandleEvent(event models.Event) error {
eh.mu.Lock()
defer eh.mu.Unlock()
eh.wsConnections = removeDisconnectedSockets(eh.wsConnections)

log.Trace().Msgf("Number of active connections: %d", len(eh.wsConnections))
}
return nil
}
1 change: 1 addition & 0 deletions pkg/query/websocket/websocket_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (wC *WebsocketConnection) ReadForDisconnect() {
wC.IsConnected = false
break
} else {
log.Debug().Interface("authReq", authRequest).Msg("Received auth request")
_, err = auth.VerifyToken(authRequest.Token)
if err != nil {
log.Debug().Err(err).Msg("Error while verifying token")
Expand Down
Loading