Skip to content

Commit

Permalink
removed unused const
Browse files Browse the repository at this point in the history
  • Loading branch information
astelmashenko committed Sep 17, 2024
1 parent aabb79e commit 56921ee
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions pkg/channel/jetstream/dispatcher/pull_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,21 @@ import (
)

const (
batchGoRoutinesEnv = "BATCH_GOROUTINES"
fetchBatchSizeEnv = "FETCH_BATCH_SIZE"
fetchBatchSizeEnv = "FETCH_BATCH_SIZE"
)

var (
// NumBatchGoRoutines is the number of goroutines that will be used to consume messages from
// the queue, there are a number of factors you will want to tweak this number. This can be
// configured via the BATCH_GOROUTINES environment variable.
//
// If you have sufficient resources, it is better to have NumBatchGoRoutines equal to
// FetchBatchSize so that messages received by JetStream are immediately processed. This will
// give the upstream request the closest amount of time to respond to the consumer's configured
// AckWait. This is beneficial because if the eventing subscriber is a scale-to-zero service,
// you have more time for resources to spin up.
//
// If you have limited resources, you may want to reduce the number of goroutines.
NumBatchGoRoutines = 32

// FetchBatchSize is the number of messages that will be fetched from JetStream in a single
// request. This can be configured via the FETCH_BATCH_SIZE environment variable.
//
// If you expect to process a high-volume of messages, you may want to increase this number to
// reduce the number of requests made to JetStream. Depending on the expected latency eventing
// subscribers, you may also want to increase NumBatchGoRoutines.
// reduce the number of requests made to JetStream.
FetchBatchSize = 32

FetchMaxWaitDefault = 200 * time.Millisecond
)

func init() {
batchSize, err := strconv.Atoi(os.Getenv(batchGoRoutinesEnv))
if err == nil {
NumBatchGoRoutines = batchSize
}

fetchSize, err := strconv.Atoi(os.Getenv(fetchBatchSizeEnv))
if err == nil {
FetchBatchSize = fetchSize

Check warning on line 60 in pkg/channel/jetstream/dispatcher/pull_consumer.go

View check run for this annotation

Codecov / codecov/patch

pkg/channel/jetstream/dispatcher/pull_consumer.go#L60

Added line #L60 was not covered by tests
Expand Down

0 comments on commit 56921ee

Please sign in to comment.