File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ func shouldRetry(err error, retryTimeout bool) bool {
58
58
if strings .HasPrefix (s , "LOADING " ) {
59
59
return true
60
60
}
61
- if strings . HasPrefix ( s , "READONLY " ) {
61
+ if isReadOnlyError ( err ) {
62
62
return true
63
63
}
64
64
if strings .HasPrefix (s , "CLUSTERDOWN " ) {
@@ -137,7 +137,14 @@ func isLoadingError(err error) bool {
137
137
}
138
138
139
139
func isReadOnlyError (err error ) bool {
140
- return strings .HasPrefix (err .Error (), "READONLY " )
140
+ redisError := err .Error ()
141
+ if strings .HasPrefix (redisError , "READONLY " ) {
142
+ return true
143
+ }
144
+
145
+ // For a Lua script that includes a write command, the error string
146
+ // contains "-READONLY" rather than beginning with "READONLY "
147
+ return strings .Contains (redisError , "-READONLY" )
141
148
}
142
149
143
150
func isMovedSameConnAddr (err error , addr string ) bool {
You can’t perform that action at this time.
0 commit comments