Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
another-rex committed Jun 3, 2024
1 parent d5d3980 commit 120c931
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions gcp/appengine/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def smart_cache(
"""
The decorated function will be cached with the given key.
If the decorated function is called any time after half the timeout of the cache,
the cached value will still be returned, but the cache will be refreshed in an
asynchronous background thread.
If the decorated function is called any time after half the timeout
of the cache, the cached value will still be returned, but the cache
will be refreshed in an asynchronous background thread.
Currently this decorator does not support differing arguments.
"""
if key in _executor_map:
raise Exception('key already exists')
raise ValueError('key already exists')

# Only require one background thread to run per cache key
# since we check whether an existing update task is already running
Expand Down
3 changes: 2 additions & 1 deletion gcp/appengine/frontend_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ def osv_get_ecosystems():
def osv_get_ecosystem_counts_cached():
"""Get count of vulnerabilities per ecosystem, cached"""
# Check if we're already in ndb context, if not, put us in one
# We can sometimes not be in ndb context because caching runs in a separate thread
# We can sometimes not be in ndb context because caching
# runs in a separate thread
if ndb.get_context(raise_context_error=False) is None:
# Make sure this ndb.Client is the same as the one defined in main.py
with ndb.Client().context():
Expand Down

0 comments on commit 120c931

Please sign in to comment.