(ctx context.Context, channel string, payload string, onConfig func([]byte) error)
| 931 | } |
| 932 | |
| 933 | func (c *Client) handleSubscriptionPayload(ctx context.Context, channel string, payload string, onConfig func([]byte) error) error { |
| 934 | payload = strings.TrimSpace(payload) |
| 935 | if payload == "" { |
| 936 | return nil |
| 937 | } |
| 938 | |
| 939 | switch strings.ToLower(strings.TrimSpace(channel)) { |
| 940 | case redisChannelConfig: |
| 941 | if onConfig == nil { |
| 942 | return nil |
| 943 | } |
| 944 | return onConfig([]byte(payload)) |
| 945 | case redisChannelCluster: |
| 946 | return c.updateClusterNodesFromPayload([]byte(payload)) |
| 947 | default: |
| 948 | return nil |
| 949 | } |
| 950 | } |
| 951 | |
| 952 | // StartConfigSubscriber connects to home, fetches config once via GET config, then subscribes to |
| 953 | // the "config" channel to receive runtime config updates. |
no test coverage detected