Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 14, 2025
1 parent 2339f61 commit 5c207b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You will need to set the following environmental variables:
- `QUERY_WAIT_SECONDS` - The number of seconds to wait for an on going query
- `CACHE_TIME_SECONDS` - The time in seconds to cache the data is used for
- `DELETE_CACHE_TIME_SECONDS` - The time in seconds to after which the cache is delete
- `LOGLEVEL` - The log level for the application.
- `LOGLEVEL` - The log level for the application.

Note you will need a database set up at `DB_URL`. This should use the datamodel in [nowcasting_datamodel](https://github.com/openclimatefix/nowcasting_datamodel)

Expand Down
16 changes: 10 additions & 6 deletions src/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,19 @@ def wrapper(*args, **kwargs): # noqa
if route_variables in response:
return response[route_variables]
else:
logger.warning(f"Process finished running but response not "
f"in cache. Setting this route as not running, "
f"and continuing")
logger.warning(
f"Process finished running but response not "
f"in cache. Setting this route as not running, "
f"and continuing"
)
currently_running[route_variables] = False
break

logger.warning(f"Waited {QUERY_WAIT_SECONDS} seconds but response not "
f"in cache. Setting this route as not running, "
f"and continuing")
logger.warning(
f"Waited {QUERY_WAIT_SECONDS} seconds but response not "
f"in cache. Setting this route as not running, "
f"and continuing"
)
currently_running[route_variables] = False

# 1.1 check if its been called before and not currently running
Expand Down

0 comments on commit 5c207b8

Please sign in to comment.