add support for a passive monitor url
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
a3e56a4e26
commit
5916dd1508
1 changed files with 9 additions and 1 deletions
|
@ -347,6 +347,9 @@ def on_close(ws, status_code, msg):
|
||||||
def on_open(ws):
|
def on_open(ws):
|
||||||
|
|
||||||
def run(*args):
|
def run(*args):
|
||||||
|
if "MONITOR_URL" in config:
|
||||||
|
r = requests.get(config['MONITOR_URL'])
|
||||||
|
step = 0
|
||||||
while not _error.isSet():
|
while not _error.isSet():
|
||||||
qmsg = Queue.query.one_or_none()
|
qmsg = Queue.query.one_or_none()
|
||||||
if qmsg:
|
if qmsg:
|
||||||
|
@ -354,7 +357,12 @@ def on_open(ws):
|
||||||
db_session.delete(qmsg)
|
db_session.delete(qmsg)
|
||||||
db_session.commit()
|
db_session.commit()
|
||||||
ws.send(".")
|
ws.send(".")
|
||||||
time.sleep(3)
|
if "MONITOR_URL" in config and step > 5:
|
||||||
|
r = requests.get(config['MONITOR_URL'])
|
||||||
|
step = 0
|
||||||
|
elif "MONITOR_URL" in config:
|
||||||
|
step += 1
|
||||||
|
time.sleep(5)
|
||||||
logger.debug("*** terminate ***")
|
logger.debug("*** terminate ***")
|
||||||
|
|
||||||
t = threading.Thread(target=run)
|
t = threading.Thread(target=run)
|
||||||
|
|
Loading…
Reference in a new issue