Commit bd21b27
feat: Add MaxMovedRedirections option to prevent infinite redirect loops (#92)
* implement MovedRetries
Signed-off-by: nirchetrit <[email protected]>
* - Changed module path from github.com/valkey-io/valkey-go to github.com/nirchetrit/valkey-go
- Added dependency for github.com/valkey-io/valkey-go v1.0.67
- Removed indirect dependencies for github.com/kr/pretty and github.com/kr/text
Signed-off-by: nirchetrit <[email protected]>
* update module path from github.com/nirchetrit/valkey-go to github.com/valkey-io/valkey-go
Signed-off-by: nirchetrit <[email protected]>
* added MaxMovedRetries to the readme
Signed-off-by: nirchetrit <[email protected]>
* Implement MaxMovedRetries logic in DoMulti and DoMultiCache methods, ensuring proper error handling and retry behavior. Update README to clarify the behavior of MaxMovedRetries for multi-command operations.
Signed-off-by: nirchetrit <[email protected]>
* Update module path from github.com/valkey-io/valkey-go to github.com/nirchetrit/valkey-go
Signed-off-by: nirchetrit <[email protected]>
* Refactor MaxMovedRetries handling in DoMulti and DoMultiCache methods to use a local movedRetries counter. This improves error handling for exceeded retry limits and ensures consistent behavior across retry attempts.
Signed-off-by: nirchetrit <[email protected]>
* Update module path from github.com/nirchetrit/valkey-go to github.com/valkey-io/valkey-go and remove outdated dependencies. Adjust golang.org/x/tools version to v0.28.0.
Signed-off-by: nirchetrit <[email protected]>
* Revert changes to README.md
Signed-off-by: nirchetrit <[email protected]>
* Rename MaxMovedRetries to MaxMovedRedirections and update related error handling in cluster and test files for consistency.
Signed-off-by: nirchetrit <[email protected]>
* Enhance error handling for MaxMovedRedirections in cluster.go by refining the condition checks for ValkeyError. This ensures that errors related to moved keys are correctly identified and handled during retries.
Signed-off-by: nirchetrit <[email protected]>
* Clarify comments in cluster.go regarding error handling for MOVED responses during retries. This enhances code readability and maintains consistency with previous error handling updates.
Signed-off-by: nirchetrit <[email protected]>
* Rename MaxMovedRedirections to MaxRedirects and handle ASK redirections. expose the last received error instead of a generic max moved errors exceeded
Signed-off-by: nirchetrit <[email protected]>
* Add tests for handling ASK and MOVED errors in cluster client
This commit introduces multiple test cases in cluster_test.go to validate the behavior of the cluster client when exceeding the maximum allowed ASK retries and handling mixed MOVED and ASK errors. The tests ensure that the client correctly identifies and returns ValkeyError for these scenarios, enhancing the robustness of error handling in the client.
The new tests cover:
- Exceeding max ASK retries for Do, DoCache, DoMulti, and DoMultiCache methods.
- Handling mixed MOVED and ASK errors during retries.
These additions improve the overall reliability of the cluster client in error-prone situations.
Signed-off-by: nirchetrit <[email protected]>
* revert go.mod
Signed-off-by: Rueian <[email protected]>
---------
Signed-off-by: nirchetrit <[email protected]>
Signed-off-by: Rueian <[email protected]>
Co-authored-by: Rueian <[email protected]>
Signed-off-by: Rueian <[email protected]>1 parent 0a9e664 commit bd21b27
3 files changed
+757
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| 540 | + | |
540 | 541 | | |
541 | 542 | | |
542 | 543 | | |
| |||
549 | 550 | | |
550 | 551 | | |
551 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
552 | 557 | | |
553 | 558 | | |
554 | 559 | | |
| |||
557 | 562 | | |
558 | 563 | | |
559 | 564 | | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
560 | 569 | | |
561 | 570 | | |
562 | 571 | | |
| |||
868 | 877 | | |
869 | 878 | | |
870 | 879 | | |
| 880 | + | |
871 | 881 | | |
872 | 882 | | |
873 | 883 | | |
| |||
892 | 902 | | |
893 | 903 | | |
894 | 904 | | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
895 | 909 | | |
896 | 910 | | |
897 | 911 | | |
| |||
920 | 934 | | |
921 | 935 | | |
922 | 936 | | |
| 937 | + | |
923 | 938 | | |
924 | 939 | | |
925 | 940 | | |
| |||
933 | 948 | | |
934 | 949 | | |
935 | 950 | | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
936 | 955 | | |
937 | 956 | | |
938 | 957 | | |
| |||
941 | 960 | | |
942 | 961 | | |
943 | 962 | | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
944 | 967 | | |
945 | 968 | | |
946 | 969 | | |
| |||
1235 | 1258 | | |
1236 | 1259 | | |
1237 | 1260 | | |
| 1261 | + | |
1238 | 1262 | | |
1239 | 1263 | | |
1240 | 1264 | | |
| |||
1259 | 1283 | | |
1260 | 1284 | | |
1261 | 1285 | | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
1262 | 1290 | | |
1263 | 1291 | | |
1264 | 1292 | | |
| |||
0 commit comments