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.

Cache init parametes bug

See original GitHub issue

https://github.com/ipinfo/python/blob/master/ipinfo/handler.py#L42

In case cache_options was defined, we end up “re-seinding” it, after having retrieved maxsize and ttl from the same dictionary. This way we multiply the same parameter in the function call, thus it can’t perform.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
juditnovakcommented, Oct 29, 2019

Sorry, my report wasn’t sufficiently verbose.

Calling the getHandler() function with cache_options parameters, such as

handler = ipinfo.getHandler(
    IPINFO_TOKEN,
    cache_options={
        'ttl': IPINFO_CACHE_TTL,
        'maxsize': IPINFO_CACHE_SIZE
    }
)

results in:

Traceback (most recent call last):
  File "ipinfo_test.py", line 12, in <module>
    'maxsize': IPINFO_CACHE_SIZE
  File "/home/judit/.virtualenvs/logstore-EsX514WN/lib/python3.7/site-packages/ipinfo/__init__.py", line 6, in getHandler
    return Handler(access_token, **kwargs)
  File "/home/judit/.virtualenvs/logstore-EsX514WN/lib/python3.7/site-packages/ipinfo/handler.py", line 42, in __init__
    self.cache = DefaultCache(maxsize, ttl, **cache_options)
TypeError: __init__() got multiple values for argument 'ttl'

(This was what I meant, by ‘can not perform’ 😃 )

The reason is https://github.com/ipinfo/python/blob/master/ipinfo/handler.py#L42 .

We are setting default values for maxsize and ttl (in case they were not defined). However, in case they were defined, we end up sending both named parameters a second time, in **cache_options

1reaction
juditnovakcommented, Oct 30, 2019

Thx much, this is what I call a prompt response and a quick fix! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

gc: requires loading parameters files · Issue #7585 · iterative/dvc
Bug Report Description When "dvc.yaml" references a parameter file ... This will remove all cache except items used in the workspace and all ......
Read more >
[BUG] CacheInitialization deadlocks and prevents ...
If CacheInitialization is used and Addressable initialization process is started too soon (before Caching.ready == true) the CacheInitOp.
Read more >
Advanced topics on caching in Apollo Client
This article describes special cases and considerations when using the Apollo Client cache. Bypassing the cache. Sometimes you shouldn't use the cache for...
Read more >
Spring 3.1 Cache Abstraction without parameters
Short answer: Yes, methods without any arguments will get cached just like any other methods. I guess there will be exactly one entry...
Read more >
Oracle Waits and Latches Related to Initialization Parameters
Setting Oracle initialization parameters incorrectly can result in performance issues that show up as general waits or latch waits in a ...
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