Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Resilient between timecaches not working #146

Open
idanarye opened this issue Jan 20, 2019 · 1 comment
Open

Resilient between timecaches not working #146

idanarye opened this issue Jan 20, 2019 · 1 comment

Comments

@idanarye
Copy link

Running this script:

from easypy.resilience import resilient
from easypy.caching import timecache


@timecache(1)
@resilient(default='default')
@timecache(1)
def foo():
    raise Exception


print(foo())

Creates throws an exception. Removing either timecache makes it print "default".

@idanarye
Copy link
Author

The problem is the update_wrapper call inside _TimeCache.__init__. It copies the dict of the func - which copies the func of the resilient, which is the inner timecache, over the func of the outer timecache - thus bypassing the resilient completely.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant