Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache_alias option is not respected in FunctionJob and cacheback decorator #80

Open
Kobold opened this issue Oct 2, 2018 · 1 comment

Comments

@Kobold
Copy link
Contributor

Kobold commented Oct 2, 2018

Just that, if you pass the cache_alias option to a FunctionJob (and hence the cacheback decorator), the resulting function won't respect it. The reason why is because FunctionJob's super __init__ is called before self.cache_alias is set:

super(FunctionJob, self).__init__()
if lifetime is not None:
self.lifetime = int(lifetime)
if fetch_on_miss is not None:
self.fetch_on_miss = fetch_on_miss
if cache_alias is not None:
self.cache_alias = cache_alias

But of course, FunctionJob's super __init__ depends on self.cache_alias, so it's too late to influence the initialization of the cache.

I'm actually responsible for this bug, so I'll also submit a PR. 🙂

@iurisilvio
Copy link

My PR fix that too.

#101

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

No branches or pull requests

2 participants