Skip to content

Commit 3dcb827

Browse files
authored
Merge pull request #307 from cardanoapi/fix/api-status-page
fix: fix api health check for kafka
2 parents 4d5049f + 8c9b21b commit 3dcb827

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

api/backend/app/controllers/health.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ async def readiness_check():
5555
is_kafka_healthy = await kafka_health_check()
5656
is_db_healthy = await database_health_check()
5757
is_dbsync_healthy = await dbsync_health_check()
58-
5958
backend_health_stat = {
6059
"isHealthy": is_db_healthy and is_kafka_healthy and is_dbsync_healthy,
6160
"details": {
@@ -88,10 +87,7 @@ async def database_health_check():
8887
async def kafka_health_check():
8988
last_poll_timestamp = await kafka_service.fetch_latest_poll_timestamp()
9089
current_timestamp = int(datetime.timestamp(datetime.now()) * 1000)
91-
if (
92-
last_poll_timestamp
93-
and (current_timestamp - last_poll_timestamp) < 3000
94-
and (current_timestamp - last_poll_timestamp) > 0
95-
):
90+
if last_poll_timestamp and 30000 > (current_timestamp - last_poll_timestamp) > 0:
9691
return True
92+
print("time difference : ", current_timestamp - last_poll_timestamp)
9793
return False

api/backend/app/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
root_api_router = APIRouter(prefix="/api")
2626

27-
# For ready status Api
27+
# For health status Api
2828
root_api_router.include_router(health.router, tags=["health"])
2929

3030
# For Demo Ping APi

0 commit comments

Comments
 (0)