fix(idempotency): include decorated fn name in hash#869
fix(idempotency): include decorated fn name in hash#869heitorlessa merged 3 commits intoaws-powertools:developfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #869 +/- ##
========================================
Coverage 99.90% 99.90%
========================================
Files 118 118
Lines 5125 5126 +1
Branches 571 571
========================================
+ Hits 5120 5121 +1
Misses 2 2
Partials 3 3
Continue to review full report at Codecov.
|
| self.hash_function = None | ||
|
|
||
| def configure(self, config: IdempotencyConfig) -> None: | ||
| def configure(self, config: IdempotencyConfig, function_name: str) -> None: |
There was a problem hiding this comment.
@heitorlessa - should this be optional? or required?
There was a problem hiding this comment.
Optional. Only because it's a public method and we have no way of knowing if someone took a dependency on it via tests or something - if they did, we will break them and take another release to fix it
heitorlessa
left a comment
There was a problem hiding this comment.
two minor changes: 1/ make function_name optional as we don't know who ended up taking a dependency on that public method (Hyrum's Law), 2/ use f-string to optimize memory and a CPU cycle as str is more expensive in Python than usual
| self.hash_function = None | ||
|
|
||
| def configure(self, config: IdempotencyConfig) -> None: | ||
| def configure(self, config: IdempotencyConfig, function_name: str) -> None: |
There was a problem hiding this comment.
Optional. Only because it's a public method and we have no way of knowing if someone took a dependency on it via tests or something - if they did, we will break them and take another release to fix it
aws_lambda_powertools/utilities/idempotency/persistence/base.py
Outdated
Show resolved
Hide resolved
make configure backwards compatible resolve the full function name ahead of time
|
@heitorlessa @cakepietoast - i have pushed recommended changes. |
Issue #, if available:
Description of changes:
Include the callable function name in the generated idempotent key
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.