@@ -325,71 +325,6 @@ func (c *client) ListInactiveSandboxes(ctx context.Context, before time.Time, li
325325 return c .loadSandboxesBySessionIDs (ctx , ids )
326326}
327327
328- // loadSandboxesByIDs loads sandbox objects for the given sandbox IDs.
329- func (c * client ) loadSandboxesByIDs (ctx context.Context , sandboxIDs []string ) ([]* types.SandboxRedis , error ) {
330- if len (sandboxIDs ) == 0 {
331- return nil , nil
332- }
333-
334- sessionIDCmds := make ([]* redisv9.StringCmd , len (sandboxIDs ))
335- pipe := c .rdb .Pipeline ()
336- for i , id := range sandboxIDs {
337- sessionKey := c .sandboxKey (id )
338- sessionIDCmds [i ] = pipe .Get (ctx , sessionKey )
339- }
340- _ , _ = pipe .Exec (ctx )
341-
342- type pair struct {
343- sandboxID string
344- sessionID string
345- }
346- pairs := make ([]pair , 0 , len (sandboxIDs ))
347-
348- for i , cmd := range sessionIDCmds {
349- sessionID , err := cmd .Result ()
350- if errors .Is (err , redisv9 .Nil ) {
351- continue
352- }
353- if err != nil {
354- return nil , fmt .Errorf ("loadSandboxesByIDs: get sessionID for sandbox %s: %w" , sandboxIDs [i ], err )
355- }
356- pairs = append (pairs , pair {
357- sandboxID : sandboxIDs [i ],
358- sessionID : sessionID ,
359- })
360- }
361-
362- if len (pairs ) == 0 {
363- return nil , nil
364- }
365-
366- sandboxCmds := make ([]* redisv9.StringCmd , len (pairs ))
367- pipe = c .rdb .Pipeline ()
368- for i , p := range pairs {
369- sessionKey := c .sessionKey (p .sessionID )
370- sandboxCmds [i ] = pipe .Get (ctx , sessionKey )
371- }
372- _ , _ = pipe .Exec (ctx )
373-
374- result := make ([]* types.SandboxRedis , 0 , len (pairs ))
375- for i , cmd := range sandboxCmds {
376- data , err := cmd .Bytes ()
377- if errors .Is (err , redisv9 .Nil ) {
378- continue
379- }
380- if err != nil {
381- return nil , fmt .Errorf ("loadSandboxesByIDs: get sandbox JSON for session %s: %w" , pairs [i ].sessionID , err )
382- }
383- var sandboxRedis types.SandboxRedis
384- if err := json .Unmarshal (data , & sandboxRedis ); err != nil {
385- return nil , fmt .Errorf ("loadSandboxesByIDs: unmarshal sandbox for session %s: %w" , pairs [i ].sessionID , err )
386- }
387- result = append (result , & sandboxRedis )
388- }
389-
390- return result , nil
391- }
392-
393328// loadSandboxesBySessionIDs loads sandbox objects for the given session IDs.
394329func (c * client ) loadSandboxesBySessionIDs (ctx context.Context , sessionIDs []string ) ([]* types.SandboxRedis , error ) {
395330 if len (sessionIDs ) == 0 {
0 commit comments