Skip to content

Commit

Permalink
[ADD] inform when result is not ready yet
Browse files Browse the repository at this point in the history
  • Loading branch information
metemaddar committed Mar 16, 2023
1 parent 1a57de9 commit 3d89e63
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/api/src/endpoints/v1/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time
from typing import Any, List, Optional, Union

from fastapi import APIRouter, Body, Depends, HTTPException, Query
from fastapi import APIRouter, Body, Depends, HTTPException, Query, status
from fastapi.encoders import jsonable_encoder
from sqlalchemy import func, text
from sqlalchemy.ext.asyncio.session import AsyncSession
Expand Down Expand Up @@ -79,6 +79,12 @@ async def get_heatmap_result(

elif result.failed():
raise HTTPException(status_code=500, detail="Task failed")
else:
content = {
"task-status": result.status,
"details": "Task is still running, please try again later",
}
return JSONResponse(status_code=status.HTTP_102_PROCESSING, content=content)



Expand Down

0 comments on commit 3d89e63

Please sign in to comment.