Skip to content

Commit f4e8023

Browse files
committed
chore(api): clarify cleaner comments and warning message
Address PR feedback: the inline comment in RunOnce contradicted what evictExpired actually does, and the warning message referenced a non-existent ErrNotFound precondition.
1 parent 8bc7d4b commit f4e8023

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • packages/api/internal/sandbox/storage/redis

packages/api/internal/sandbox/storage/redis/cleaner.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ func (c *Cleaner) RunOnce(ctx context.Context) error {
5959
var errs []error
6060

6161
// 1. globalExpirationSet: ExpiredItems internally ZREMs members whose sandbox JSON is gone (items.go:131-135).
62-
// 2. Discard the returned sandbox list (only if older than StaleCutoff) since the cleaner is not responsible for removing sandboxes
62+
// 2. evictExpired removes sandboxes whose EndTime is older than StaleCutoff;
63+
// recently expired ones are left to the evictor to avoid racing it.
6364
expired, err := c.storage.ExpiredItems(ctx)
6465
if err != nil {
6566
errs = append(errs, fmt.Errorf("expiration index sweep: %w", err))
@@ -88,7 +89,7 @@ func (c *Cleaner) evictExpired(ctx context.Context, expired []sandbox.Sandbox) {
8889
}
8990

9091
if rmErr := c.storage.Remove(context.WithoutCancel(ctx), sbx.TeamID, sbx.SandboxID); rmErr != nil {
91-
logger.L().Warn(ctx, "Cleaner failed to purge stale Redis entry after ErrNotFound",
92+
logger.L().Warn(ctx, "Cleaner failed to remove stale expired sandbox",
9293
zap.Error(rmErr),
9394
logger.WithSandboxID(sbx.SandboxID),
9495
logger.WithTeamID(sbx.TeamID.String()),

0 commit comments

Comments
 (0)