You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/utilities/idempotency.md
+7-9
Original file line number
Diff line number
Diff line change
@@ -482,10 +482,10 @@ sequenceDiagram
482
482
deactivate Persistence Layer
483
483
Note over Response hook,Persistence Layer: Record status is COMPLETE and not expired
484
484
Response hook->>Lambda: Response hook invoked
485
-
Lambda-->>Client: Same response sent to client
485
+
Lambda-->>Client: Manipulated idempotent response sent to client
486
486
end
487
487
```
488
-
<i>Idempotent successful request with response hook</i>
488
+
<i>Successful idempotent request with a response hook</i>
489
489
</center>
490
490
491
491
#### Expired idempotency records
@@ -946,7 +946,7 @@ You can create your own persistent store from scratch by inheriting the `BasePer
946
946
947
947
### Manipulating the Idempotent Response
948
948
949
-
You can set up a `response_hook` in the `IdempotentConfig` class to access the returned data when an operation is idempotent. The hook function will be called with the current deserialized response object and the Idempotency record.
949
+
You can set up a `response_hook` in the `IdempotentConfig` class to manipulate the returned data when an operation is idempotent. The hook function will be called with the current deserialized response object and the Idempotency record.
950
950
951
951
=== "Using an Idempotent Response Hook"
952
952
@@ -966,15 +966,13 @@ You can set up a `response_hook` in the `IdempotentConfig` class to access the r
966
966
967
967
#### Being a good citizen
968
968
969
-
Using Response hooks can add subtle improvements to manipulating returned data from idempotent operations, but also add significant complexity if you're not careful.
970
-
971
-
Keep the following in mind when authoring hooks for Idempotency utility:
969
+
When using response hooks to manipulate returned data from idempotent operations, it's important to follow best practices to avoid introducing complexity or issues. Keep these guidelines in mind:
972
970
973
-
1.**Response hook works exclusively when operations are idempotent.**Carefully consider the logic within the `Response hook` and prevent any attempt to access the key from relying exclusively on idempotent operations.
971
+
1.**Response hook works exclusively when operations are idempotent.**The hook will not be called when an operation is not idempotent, or when the idempotent logic fails.
974
972
975
-
2.**Catch your own exceptions.**Catch and handle known exceptions to your logic.
973
+
2.**Catch and Handle Exceptions.**Your response hook code should catch and handle any exceptions that may arise from your logic. Unhandled exceptions will cause the Lambda function to fail unexpectedly.
976
974
977
-
3.**Watch out when you are decorating the Lambda Handler and using the Response hook.** If you don't catch and handle exceptions in your `Response hook`, your function might not run properly.
975
+
3.**Keep Hook Logic Simple** Response hooks should consist of minimal and straightforward logic for manipulating response data. Avoid complex conditional branching and aim for hooks that are easy to reason about.
0 commit comments