-
Notifications
You must be signed in to change notification settings - Fork 233
Fix an issue with updating data in redis #1708
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,7 +132,7 @@ func (s *Storage) Update(ctx context.Context, sandboxID string, updateFunc func( | |
| } | ||
|
|
||
| // Execute transaction | ||
| err = s.redisClient.Set(ctx, key, newData, redis.KeepTTL).Err() | ||
| err = s.redisClient.Set(ctx, key, newData, 0).Err() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Using Useful? React with 👍 / 👎. |
||
| if err != nil { | ||
| return sandbox.Sandbox{}, err | ||
| } | ||
|
|
||
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.
Setting TTL to
0means no expiration. BothAdd()(line 29) and nowUpdate()store keys without expiration, but the comment on line 28 says "with max expiration little bit longer than max instance length to prevent leaking". This means sandbox data will persist indefinitely in Redis unless explicitly removed viaRemove(). If the cleanup logic fails, this could cause memory leaks. Consider either: (1) setting an actual TTL value (e.g., based on max instance lifetime), or (2) updating the comment to reflect that Redis is not being used as a TTL-based cache for sandboxes.