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.
packages/api/internal/sandbox/storage/redis/subscription_manager_test.go
Outdated
Show resolved
Hide resolved
packages/api/internal/sandbox/storage/redis/subscription_manager.go
Outdated
Show resolved
Hide resolved
Syncs all application code from e2b-dev/infra upstream including: - Redis PubSub for state transitions (e2b-dev#2099) - Pluggable egress firewall (e2b-dev#2187) - Firecracker v1.12 upgrade (e2b-dev#2245) - Label-based sandbox scheduler (e2b-dev#2066) - Orchestrator internal/ -> pkg/ migration - Pre-compute cgroup CPU deltas (e2b-dev#2265) - Arch-aware downloads (e2b-dev#2258, e2b-dev#2260) - Customizable pre-warmed NBDs (e2b-dev#2266) - Autoresume improvements (e2b-dev#1969, e2b-dev#2196) - Many bug fixes for race conditions, eviction, error handling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Improves the speed for transitions, prevents spamming redis with repeated polls, reduced the risk of blocking all connections by polling state change