Skip to content

Commit

Permalink
increase router concurrency; decrese sqlpublisher poll interval (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalef committed Nov 5, 2023
1 parent 89b5f46 commit 52d4e67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/tasks/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// TODO: Add these to config
const TaskCountThrottle = 50 // messages per second
const TaskCountThrottle = 250 // messages per second
const MaxQueueRetries = 5
const TaskTimeout = 60 // seconds

Expand Down
4 changes: 4 additions & 0 deletions pkg/tasks/sql_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package tasks

import (
"database/sql"
"time"

"github.com/ThreeDotsLabs/watermill"
wsql "github.com/ThreeDotsLabs/watermill-sql/v2/pkg/sql"
"github.com/ThreeDotsLabs/watermill/message"
)

const SQLSubscriberPollInterval = 500 * time.Millisecond

type SQLSchema struct {
wsql.DefaultPostgreSQLSchema
}
Expand Down Expand Up @@ -36,6 +39,7 @@ func NewSQLQueueSubscriber(db *sql.DB, logger watermill.LoggerAdapter) (message.
SchemaAdapter: SQLSchema{},
OffsetsAdapter: &wsql.DefaultPostgreSQLOffsetsAdapter{},
InitializeSchema: true,
PollInterval: SQLSubscriberPollInterval,
},
logger,
)
Expand Down

0 comments on commit 52d4e67

Please sign in to comment.