From a386a8e0c9ba63718a3e5c19c4d8d536bb55e268 Mon Sep 17 00:00:00 2001 From: dsc Date: Wed, 10 Jun 2020 19:28:15 +0200 Subject: [PATCH] Caching for API version check --- funding/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/funding/api.py b/funding/api.py index a93484a..6d1e9a4 100644 --- a/funding/api.py +++ b/funding/api.py @@ -6,7 +6,7 @@ from flask_yoloapi import endpoint, parameter from funding.bin.utils import get_ip from funding.bin.qr import QrCodeGenerator -from funding.factory import app +from funding.factory import app, cache from funding.orm import Proposal @@ -72,6 +72,7 @@ def api_qr_generate(address): @endpoint.api( parameter('version', type=str, location='args', required=True) ) +@cache.cached(timeout=600 * 6, make_cache_key=lambda version: f"api_wowlight_version_check_{version}") def api_wowlight_version_check(version: str) -> bool: """ Checks incoming wow-lite wallet version, returns False when the version is too old and needs to be upgraded.