Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: major refactoring #17

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
fix(handler): instantiate cursor for paging outside loop
erabedtit committed Jan 23, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a3dcaaf9b84049c06ca4078519d3f2b869eb89ab
6 changes: 4 additions & 2 deletions internal/handler/delivering.go
Original file line number Diff line number Diff line change
@@ -41,10 +41,12 @@ func CheckDeliveringEvents() {
}
defer picker.Close()

var cursor any
for {
var lastCursor any

dbMessages, lastCursor, err := mongo.CurrentConnection.FindDeliveringMessagesByDeliveryType(upperThresholdTimestamp, lastCursor)
dbMessages, c, err := mongo.CurrentConnection.FindDeliveringMessagesByDeliveryType(upperThresholdTimestamp, cursor)
cursor = c

if err != nil {
log.Error().Err(err).Msgf("Error while fetching DELIVERING messages from database")

6 changes: 4 additions & 2 deletions internal/handler/failed.go
Original file line number Diff line number Diff line change
@@ -39,10 +39,12 @@ func CheckFailedEvents() {
}
defer picker.Close()

var cursor any
for {
var lastCursor any

dbMessages, c, err := mongo.CurrentConnection.FindFailedMessagesWithCallbackUrlNotFoundException(time.Now(), cursor)
cursor = c

dbMessages, _, err := mongo.CurrentConnection.FindFailedMessagesWithCallbackUrlNotFoundException(time.Now(), lastCursor)
if err != nil {
log.Error().Err(err).Msgf("Error while fetching messages for subscription from database")
return