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
8 changes: 6 additions & 2 deletions pubsub/redis/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ metadata:
type: string
- name: maxLenApprox
required: false
description: Maximum number of items inside a stream. The old entries are automatically evicted when the specified length is reached, so that the stream is left at a constant size. Defaults to unlimited.
description: |
Maximum number of items inside a stream. The old entries are automatically evicted when the specified length is reached,
so that the stream is left at a constant size. Defaults to unlimited.
Cannot be used together with streamTTL; only one stream trimming strategy can be active at a time.
example: "10000"
type: number
- name: streamTTL
Expand All @@ -237,6 +240,7 @@ metadata:
This is an approximate value, as it's implemented using Redis stream's MINID trimming with the '~' modifier.
The actual retention may include slightly more entries than strictly defined by the TTL,
as Redis optimizes the trimming operation for efficiency by potentially keeping some additional entries.
Cannot be used together with maxLenApprox; only one stream trimming strategy can be active at a time.
example: "30d"
type: duration

Expand All @@ -254,4 +258,4 @@ builtinAuthenticationProfiles:
- name: enableTLS
required: true
description: Must be set to true if using EntraID
example: "true"
example: "true"
4 changes: 4 additions & 0 deletions pubsub/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ func (r *redisStreams) Init(ctx context.Context, metadata pubsub.Metadata) error
if _, err = r.client.PingResult(ctx); err != nil {
return fmt.Errorf("redis streams: error connecting to redis at %s: %s", r.clientSettings.Host, err)
}

if r.clientSettings.MaxLenApprox > 0 && r.clientSettings.StreamTTL > 0 {
r.logger.Warn("redis streams: maxLenApprox and streamTTL cannot be used together; only one stream trimming strategy can be active at a time.")
}
r.queue = make(chan redisMessageWrapper, int(r.clientSettings.QueueDepth)) //nolint:gosec

for range r.clientSettings.Concurrency {
Expand Down
Loading