diff --git a/app.py b/app.py index 58b12a9..db01399 100644 --- a/app.py +++ b/app.py @@ -401,6 +401,12 @@ def poll_provisioning(): failed += 1 except Exception as e: app.logger.warning("poll order %s failed: %s", row["iproyal_order_id"], e) + # expire past-due active IPs + d = db.get_db() + d.execute("UPDATE dedicated_ips SET status='expired' WHERE status='active' " + "AND expires_at > 0 AND expires_at < ?", (int(time.time()),)) + d.commit() + d.close() return ok, failed