Skip to content

Commit

Permalink
Add a sleep route to test timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-ide committed Dec 12, 2023
1 parent 8f13acd commit bd6e190
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions webapp/home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import pickle
from shutil import copyfile, move, rmtree
import subprocess
import time
from urllib.parse import urlencode, urlparse, quote, unquote
from zipfile import ZipFile

Expand Down Expand Up @@ -308,6 +309,17 @@ def reload_metadata():
return current_document, eml_node


@home_bp.route('/sleep/<seconds>', methods=['GET'])
def sleep(seconds:str=None):
""" Sleep for the specified number of seconds. This is used for testing. """
try:
seconds = int(seconds)
except Exception as e:
seconds = 1
time.sleep(seconds)
return redirect(url_for(PAGE_INDEX))


# Endpoint for AJAX calls to validate XML
@home_bp.route('/check_xml/<xml>/<parent_name>', methods=['GET'])
def check_xml(xml:str=None, parent_name:str=None):
Expand Down

0 comments on commit bd6e190

Please sign in to comment.