(ctx context.Context, requestedModel string, sessionID string, headers http.Header, count int)
| 806 | } |
| 807 | |
| 808 | func (c *Client) RPopAuth(ctx context.Context, requestedModel string, sessionID string, headers http.Header, count int) ([]byte, error) { |
| 809 | cmd, errClient := c.commandClient() |
| 810 | if errClient != nil { |
| 811 | return nil, errClient |
| 812 | } |
| 813 | requestedModel = strings.TrimSpace(requestedModel) |
| 814 | if requestedModel == "" { |
| 815 | return nil, fmt.Errorf("home: requested model is empty") |
| 816 | } |
| 817 | req := newAuthDispatchRequest(requestedModel, sessionID, headers, count) |
| 818 | keyBytes, err := json.Marshal(&req) |
| 819 | if err != nil { |
| 820 | return nil, err |
| 821 | } |
| 822 | |
| 823 | raw, err := cmd.RPop(ctx, string(keyBytes)).Bytes() |
| 824 | if errors.Is(err, redis.Nil) { |
| 825 | return nil, ErrAuthNotFound |
| 826 | } |
| 827 | if err != nil { |
| 828 | return nil, err |
| 829 | } |
| 830 | if len(raw) == 0 { |
| 831 | return nil, ErrEmptyResponse |
| 832 | } |
| 833 | return raw, nil |
| 834 | } |
| 835 | |
| 836 | func (c *Client) GetRefreshAuth(ctx context.Context, authIndex string) ([]byte, error) { |
| 837 | cmd, errClient := c.commandClient() |
nothing calls this directly
no test coverage detected