feat(api): use Redis PubSub for state transition#2099
Conversation
531cee9 to
28a9901
Compare
packages/api/internal/sandbox/storage/redis/subscription_manager.go
Outdated
Show resolved
Hide resolved
packages/api/internal/sandbox/storage/redis/subscription_manager.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
9af4a6e to
d9f2e19
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9f2e199d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cancel context.CancelFunc | ||
| } | ||
|
|
||
| func newSubscriptionManager(ctx context.Context, redisClient redis.UniversalClient) *subscriptionManager { |
There was a problem hiding this comment.
Instead of passing in a ctx and automatically subscribing, it's probably more comfortable to expose a Start and Stop functions. That makes closing these structs easier and safer.
Improves the speed for transitions, prevents spamming redis with repeated polls, reduced the risk of blocking all connections by polling state change