(update_check_url: Optional[str] = None)
| 26 | |
| 27 | |
| 28 | async def get_update(update_check_url: Optional[str] = None) -> UpdateResponse: |
| 29 | if is_dev_version(): |
| 30 | return UpdateResponse(latest_version=__version__) |
| 31 | |
| 32 | global cached_update, cache_timestamp |
| 33 | |
| 34 | if ( |
| 35 | cached_update is None |
| 36 | or cache_timestamp is None |
| 37 | or time.time() - cache_timestamp > UPDATE_CACHE_TIMEOUT |
| 38 | ): |
| 39 | cached_update = await do_get_update(update_check_url) |
| 40 | cache_timestamp = time.time() |
| 41 | |
| 42 | return cached_update |
| 43 | |
| 44 | |
| 45 | async def do_get_update( |
no test coverage detected