question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Computation of idempotency hash key using unqualified name

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
dispyfreecommented, Jul 24, 2022

@heitorlessa I’d be pleased to contribute. Feel free to assign to me; I shall have a go at it in the coming days 😃

1reaction
heitorlessacommented, Jul 22, 2022

Thank you both, that’s super helpful. I agree in including the module as that will cover cases where people use the new typing.Protocol as well as traditional ABC interfaces.

@dispyfree would you like to do the honour and contribute the fix today?

We want to make a release today with this fix.

PS: @dispyfree I’m stoked you’re an avid customer. I’d love to hear more from you one of these days ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling Lambda functions idempotency with ... - AWS
Idempotency is the property of an operation whereby it can be applied multiple times without changing the result beyond the initial application.
Read more >
Idempotency - Lambda Powertools Python
Idempotency key is a hash representation of either the entire event or a specific configured subset of the event, and invocation results are ......
Read more >
Method: jobs.query | BigQuery - Google Cloud
Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in...
Read more >
Groovy Language Documentation
2, When we try to fetch the value with a String key, we will not find it, ... Conveniently for exact decimal number...
Read more >
perlapi - autogenerated documentation for the perl public API
Delete a key and its associated value from the cop hints hash cophh, ... The name must be unqualified; that is, it must...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found