mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-18 16:11:34 +03:00
18 lines
348 B
Python
18 lines
348 B
Python
|
# return 500 by default
|
||
|
# or 200 if previous request has been executed less than 5 second ago
|
||
|
from app import app
|
||
|
import time
|
||
|
|
||
|
last = 0
|
||
|
|
||
|
|
||
|
@app.route("/retry/until-200")
|
||
|
def retry_until_200():
|
||
|
global last
|
||
|
current = time.time()
|
||
|
interval = current - last
|
||
|
last = current
|
||
|
if interval < 5:
|
||
|
return "OK", 200
|
||
|
return "", 500
|