@@ -827,7 +827,7 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
827827 if sentinel != nil {
828828 addr , err := c .getMasterAddr (ctx , sentinel )
829829 if err != nil {
830- if errors . Is ( err , context . Canceled ) || errors . Is ( err , context . DeadlineExceeded ) {
830+ if isContextError ( ctx . Err () ) {
831831 return "" , err
832832 }
833833 // Continue on other errors
@@ -845,7 +845,7 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
845845 addr , err := c .getMasterAddr (ctx , c .sentinel )
846846 if err != nil {
847847 _ = c .closeSentinel ()
848- if errors . Is ( err , context . Canceled ) || errors . Is ( err , context . DeadlineExceeded ) {
848+ if isContextError ( ctx . Err () ) {
849849 return "" , err
850850 }
851851 // Continue on other errors
@@ -930,7 +930,7 @@ func (c *sentinelFailover) replicaAddrs(ctx context.Context, useDisconnected boo
930930 if sentinel != nil {
931931 addrs , err := c .getReplicaAddrs (ctx , sentinel )
932932 if err != nil {
933- if errors . Is ( err , context . Canceled ) || errors . Is ( err , context . DeadlineExceeded ) {
933+ if isContextError ( ctx . Err () ) {
934934 return nil , err
935935 }
936936 // Continue on other errors
@@ -948,7 +948,7 @@ func (c *sentinelFailover) replicaAddrs(ctx context.Context, useDisconnected boo
948948 addrs , err := c .getReplicaAddrs (ctx , c .sentinel )
949949 if err != nil {
950950 _ = c .closeSentinel ()
951- if errors . Is ( err , context . Canceled ) || errors . Is ( err , context . DeadlineExceeded ) {
951+ if isContextError ( ctx . Err () ) {
952952 return nil , err
953953 }
954954 // Continue on other errors
@@ -970,7 +970,7 @@ func (c *sentinelFailover) replicaAddrs(ctx context.Context, useDisconnected boo
970970 replicas , err := sentinel .Replicas (ctx , c .opt .MasterName ).Result ()
971971 if err != nil {
972972 _ = sentinel .Close ()
973- if errors . Is ( err , context . Canceled ) || errors . Is ( err , context . DeadlineExceeded ) {
973+ if isContextError ( ctx . Err () ) {
974974 return nil , err
975975 }
976976 internal .Logger .Printf (ctx , "sentinel: Replicas master=%q failed: %s" ,
0 commit comments