Skip to content

Commit

Permalink
Update apolpi.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena authored Sep 18, 2023
1 parent 40d25bd commit ab393e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apolpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

global CACHED_RESULT
global CACHED_TIME
global TIMEOUT
CACHED_RESULT = None
CACHED_TIME = 0
TIMEOUT = int(os.environ.get('TIMEOUT', 30))

app = Flask(__name__)

Expand Down Expand Up @@ -113,7 +115,7 @@ def doit():
global CACHED_TIME
global CACHED_RESULT
now = time.time()
if now - CACHED_TIME > 30:
if now - CACHED_TIME > TIMEOUT:
CACHED_RESULT = _fetch()
CACHED_TIME = now

Expand Down

0 comments on commit ab393e5

Please sign in to comment.