|
|
@ -5,7 +5,7 @@ import re
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
import click
|
|
|
|
import click
|
|
|
|
from os import makedirs
|
|
|
|
from os import makedirs
|
|
|
|
from datetime import datetime
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
from flask import Flask, request, redirect
|
|
|
|
from flask import Flask, request, redirect
|
|
|
|
from flask import render_template, flash, url_for
|
|
|
|
from flask import render_template, flash, url_for
|
|
|
|
from urllib.parse import urlparse
|
|
|
|
from urllib.parse import urlparse
|
|
|
@ -91,8 +91,16 @@ def add():
|
|
|
|
node.save()
|
|
|
|
node.save()
|
|
|
|
return redirect("/")
|
|
|
|
return redirect("/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def cleanup_health_checks():
|
|
|
|
|
|
|
|
diff = datetime.now() - timedelta(hours=2)
|
|
|
|
|
|
|
|
checks = HealthCheck.select().where(HealthCheck.datetime <= diff)
|
|
|
|
|
|
|
|
for check in checks:
|
|
|
|
|
|
|
|
print("Deleting check", check.id)
|
|
|
|
|
|
|
|
check.delete_instance()
|
|
|
|
|
|
|
|
|
|
|
|
@app.cli.command("check")
|
|
|
|
@app.cli.command("check")
|
|
|
|
def check():
|
|
|
|
def check():
|
|
|
|
|
|
|
|
cleanup_health_checks()
|
|
|
|
nodes = Node.select().where(Node.validated == True)
|
|
|
|
nodes = Node.select().where(Node.validated == True)
|
|
|
|
for node in nodes:
|
|
|
|
for node in nodes:
|
|
|
|
now = datetime.utcnow()
|
|
|
|
now = datetime.utcnow()
|
|
|
|