fix server
This commit is contained in:
parent
89b009dafb
commit
93f2f16987
@ -1049,7 +1049,6 @@ import asyncio
|
||||
import threading
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
# Add a global executor for background tasks
|
||||
executor = ThreadPoolExecutor(max_workers=4)
|
||||
@ -1067,7 +1066,7 @@ def run_tests_background(config_dict: dict, report_id: str):
|
||||
"status": result_status,
|
||||
"result": result,
|
||||
"report_directory": result.get("report_directory", task_state.get("report_directory")),
|
||||
"completed_at": datetime.now().isoformat()
|
||||
"completed_at": datetime.datetime.now().isoformat()
|
||||
})
|
||||
if result_status == "error":
|
||||
task_state["error"] = result.get("message")
|
||||
@ -1079,7 +1078,7 @@ def run_tests_background(config_dict: dict, report_id: str):
|
||||
"status": "error",
|
||||
"error": str(e),
|
||||
"traceback": traceback.format_exc(),
|
||||
"completed_at": datetime.now().isoformat()
|
||||
"completed_at": datetime.datetime.now().isoformat()
|
||||
})
|
||||
running_tasks[report_id] = task_state
|
||||
|
||||
@ -1101,7 +1100,7 @@ async def run_api_tests(config: TestConfig):
|
||||
"""
|
||||
try:
|
||||
# Generate report ID and directory
|
||||
report_id = datetime.now().strftime("%Y%m%d_%H%M%S") + "_" + str(uuid.uuid4())[:8]
|
||||
report_id = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") + "_" + str(uuid.uuid4())[:8]
|
||||
report_directory_path = (Path(REPORTS_DIR) / report_id).resolve()
|
||||
|
||||
# Prepare config
|
||||
@ -1126,7 +1125,7 @@ async def run_api_tests(config: TestConfig):
|
||||
"status": "running",
|
||||
"report_id": report_id,
|
||||
"report_directory": str(report_directory_path),
|
||||
"created_at": datetime.now().isoformat(),
|
||||
"created_at": datetime.datetime.now().isoformat(),
|
||||
"status_url": f"/status/{report_id}",
|
||||
"report_url": f"/reports/{report_id}"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user