-
Notifications
You must be signed in to change notification settings - Fork 536
Adds Redis stream trimming by time(stream ID) #3710
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
Conversation
Signed-off-by: Elena Kolevska <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We should use a TTL time duration value as part of the component field, not a timestamp- the timestamp should be computed at runtime. Component field values should be evergreen. |
Absolutely! That was my initial idea when i started doing this, I don't remember how it changed by the time I implemented it. I was just looking into it last week. I'll update the pr. |
Signed-off-by: Elena Kolevska <[email protected]>
Updated |
if s.StreamTTL == 0 { | ||
return "" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if s.StreamTTL == 0 { | |
return "" | |
} | |
if s.StreamTTL <= 0 { | |
return "" | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't fail silently, and it would be too late to return the error here (we use this on message send). We should probably catch it on init.
Signed-off-by: Elena Kolevska <[email protected]> Co-authored-by: Cassie Coyle <[email protected]> Co-authored-by: Nelson Parente <[email protected]> Co-authored-by: Yaron Schneider <[email protected]> Co-authored-by: Bernd Verst <[email protected]>
Description
Adding the option to trim Redis streams based on timestamp. When
minIDApprox
is specified in the component file entries with IDs smaller than the specified threshold are evicted, keeping the stream trimmed to only contain entries with IDs greater than or equal to this value.This can be used for time-based eviction since Redis stream IDs are in the format {timestamp-sequence}, where timestamp is in milliseconds since epoch.
Issue reference
#3664
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: