Spaces:
Sleeping
Sleeping
Commit
·
53f56de
1
Parent(s):
a7329cb
Mark API configuration as active on first run in activate_monitoring function
Browse files- api_monitor.py +9 -0
api_monitor.py
CHANGED
|
@@ -664,6 +664,15 @@ async def activate_monitoring(config_id, mcp_api_key):
|
|
| 664 |
id=f"monitor_{config_id}",
|
| 665 |
)
|
| 666 |
scheduler.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 667 |
conn.close()
|
| 668 |
return {
|
| 669 |
"success": True,
|
|
|
|
| 664 |
id=f"monitor_{config_id}",
|
| 665 |
)
|
| 666 |
scheduler.start()
|
| 667 |
+
# Mark config as active (only once, on first run)
|
| 668 |
+
if not config["is_active"]:
|
| 669 |
+
conn.execute(
|
| 670 |
+
"""
|
| 671 |
+
UPDATE api_configurations SET is_active = %s WHERE config_id = %s
|
| 672 |
+
""",
|
| 673 |
+
(True, config_id),
|
| 674 |
+
)
|
| 675 |
+
print(f"Marked configuration {config_id} as active.")
|
| 676 |
conn.close()
|
| 677 |
return {
|
| 678 |
"success": True,
|