Skip to content

Commit

Permalink
Merge pull request #1 from galaxy-genome-annotation/configurable-timeout
Browse files Browse the repository at this point in the history
Allow configuring timeout
  • Loading branch information
jasonjgill authored Sep 20, 2023
2 parents 40d25bd + 418a0b6 commit 1cf31b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY apolpi.py boot.sh ./
RUN chmod +x boot.sh

ENV FLASK_APP apolpi.py
ENV TIMEOUT 30
EXPOSE 80

ENTRYPOINT ["/apolpi/boot.sh"]
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 1cf31b3

Please sign in to comment.