( opt *Options, dialer func(ctx context.Context, network, addr string) (net.Conn, error), poolName string, )
| 776 | } |
| 777 | |
| 778 | func newPubSubPool( |
| 779 | opt *Options, |
| 780 | dialer func(ctx context.Context, network, addr string) (net.Conn, error), |
| 781 | poolName string, |
| 782 | ) (*pool.PubSubPool, error) { |
| 783 | poolSize, err := util.SafeIntToInt32(opt.PoolSize, "PoolSize") |
| 784 | if err != nil { |
| 785 | return nil, err |
| 786 | } |
| 787 | |
| 788 | minIdleConns, err := util.SafeIntToInt32(opt.MinIdleConns, "MinIdleConns") |
| 789 | if err != nil { |
| 790 | return nil, err |
| 791 | } |
| 792 | |
| 793 | maxIdleConns, err := util.SafeIntToInt32(opt.MaxIdleConns, "MaxIdleConns") |
| 794 | if err != nil { |
| 795 | return nil, err |
| 796 | } |
| 797 | |
| 798 | maxActiveConns, err := util.SafeIntToInt32(opt.MaxActiveConns, "MaxActiveConns") |
| 799 | if err != nil { |
| 800 | return nil, err |
| 801 | } |
| 802 | |
| 803 | return pool.NewPubSubPool(&pool.Options{ |
| 804 | PoolFIFO: opt.PoolFIFO, |
| 805 | PoolSize: poolSize, |
| 806 | MaxConcurrentDials: opt.MaxConcurrentDials, |
| 807 | PoolTimeout: opt.PoolTimeout, |
| 808 | DialTimeout: opt.DialTimeout, |
| 809 | DialerRetries: opt.DialerRetries, |
| 810 | DialerRetryTimeout: opt.DialerRetryTimeout, |
| 811 | DialerRetryBackoff: opt.DialerRetryBackoff, |
| 812 | MinIdleConns: minIdleConns, |
| 813 | MaxIdleConns: maxIdleConns, |
| 814 | MaxActiveConns: maxActiveConns, |
| 815 | ConnMaxIdleTime: opt.ConnMaxIdleTime, |
| 816 | ConnMaxLifetime: opt.ConnMaxLifetime, |
| 817 | ConnMaxLifetimeJitter: opt.ConnMaxLifetimeJitter, |
| 818 | ReadBufferSize: 32 * 1024, |
| 819 | WriteBufferSize: 32 * 1024, |
| 820 | PushNotificationsEnabled: opt.Protocol == 3, |
| 821 | Name: poolName, |
| 822 | }, dialer), nil |
| 823 | } |
no test coverage detected