Skip to content

Computation of idempotency hash key using unqualified name  #1330

Closed
@dispyfree

Description

@dispyfree

Expected Behaviour

The idempotency layer should be using the fully qualified name of the input function to compute the hash key.
Using unqualified names may result in two distinct functions and/or methods contending for the same set of idempotency items.

Current Behaviour

In IdempotencyHandler, line 77:

persistence_store.configure(config, self.function.__name__)

Possible Solution

persistence_store.configure(config, self.function.__qualname__)

Note that it should be checked whether __qualname__ is subject to Python module import peculiarities. In particular, whether import module and from module import funcName yield the same __qualname__.

Steps to Reproduce

class A:
    @idempotent_function
    def test(self, myParam):
        return myParam
    

class B(A):
    
    @idempotent_function
    def test(self, myParam):
        return myParam

AWS Lambda Powertools for Python version

latest

AWS Lambda function runtime

3.9

Packaging format used

PyPi

Debugging logs

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions