Skip to content

Commit

Permalink
✨ add new config params
Browse files Browse the repository at this point in the history
  • Loading branch information
koladev32 committed Jul 6, 2024
1 parent 87698c1 commit ae03698
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions sendhooks/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type Configuration struct {
Redis RedisConfig `json:"redis"`
SecretHashHeaderName string `json:"secretHashHeaderName"`
Broker string `json:"broker"`
NumWorkers int `json:"numWorkers"`
ChannelSize int `json:"channelSize"`
}

// Adapter defines methods for interacting with different queue systems.
Expand Down
2 changes: 1 addition & 1 deletion sendhooks/adapter/redis_adapter/redis_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (r *RedisAdapter) Connect() error {
Password: redisPassword,
DB: redisDBInt,
TLSConfig: tlsConfig,
PoolSize: 50,
PoolSize: r.config.NumWorkers,
})

return nil
Expand Down
4 changes: 2 additions & 2 deletions sendhooks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func main() {
}

// Define the size of the channel and the number of workers
webhookQueue := make(chan adapter.WebhookPayload, 1000)
numWorkers := 50
webhookQueue := make(chan adapter.WebhookPayload, conf.ChannelSize)
numWorkers := conf.NumWorkers

// Start the worker pool
var wg sync.WaitGroup
Expand Down

0 comments on commit ae03698

Please sign in to comment.