Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

fix: Notification logs are passed to BE with a float timestamp (#1170)

Chandrasekharan Mead853e40c3e
diff --git a/backend/backend/__init__.py b/backend/backend/__init__.py
index e921073a8..2c06973e8 100644
--- a/backend/backend/__init__.py
+++ b/backend/backend/__init__.py
@@ -1,3 +1,7 @@
+from dotenv import load_dotenv
+
from .celery_service import app as celery_app
+load_dotenv()
+
__all__ = ["celery_app"]
diff --git a/backend/backend/wsgi.py b/backend/backend/wsgi.py
index ff41a40b0..53d9e64bb 100644
--- a/backend/backend/wsgi.py
+++ b/backend/backend/wsgi.py
@@ -12,11 +12,8 @@ import time
from django.conf import settings
from django.core.wsgi import get_wsgi_application
-from dotenv import load_dotenv
from utils.log_events import start_server
-load_dotenv()
-
logger = logging.getLogger(__name__)
os.environ.setdefault(
diff --git a/backend/logs_helper/views.py b/backend/logs_helper/views.py
index ce3f632fc..b85de8a38 100644
--- a/backend/logs_helper/views.py
+++ b/backend/logs_helper/views.py
@@ -38,7 +38,7 @@ class LogsHelperViewSet(viewsets.ModelViewSet):
logs.append(log_data)
# Sort logs based on timestamp
- sorted_logs = sorted(logs, key=lambda x: x["timestamp"])
+ sorted_logs = sorted(logs, key=lambda x: float(x["timestamp"]))
return Response({"data": sorted_logs}, status=status.HTTP_200_OK)
diff --git a/backend/sample.env b/backend/sample.env
index cb5006f64..e4a700f14 100644
--- a/backend/sample.env
+++ b/backend/sample.env
@@ -129,8 +129,9 @@ LOGS_EXPIRATION_TIME_IN_SECOND=86400
# Celery Configuration
# Used by celery and to connect to queue to push logs
-CELERY_BROKER_URL = "redis://unstract-redis:6379"
-CELERY_BROKER_VISIBILITY_TIMEOUT = "86400" # 1 day
+CELERY_BROKER_URL="redis://unstract-redis:6379"
+# Redis broker visibility set to 1 day
+CELERY_BROKER_VISIBILITY_TIMEOUT=86400
# Indexing flag to prevent re-index
INDEXING_FLAG_TTL=1800
diff --git a/frontend/src/components/logs-and-notifications/LogsAndNotificationsTable.jsx b/frontend/src/components/logs-and-notifications/LogsAndNotificationsTable.jsx
index 61b848c18..a83f60aa3 100644
--- a/frontend/src/components/logs-and-notifications/LogsAndNotificationsTable.jsx
+++ b/frontend/src/components/logs-and-notifications/LogsAndNotificationsTable.jsx
@@ -5,6 +5,7 @@ import { uniqueId } from "lodash";
import { useSocketLogsStore } from "../../store/socket-logs-store";
import "./DisplayLogsAndNotifications.css";
import CustomMarkdown from "../helpers/custom-markdown/CustomMarkdown";
+import { getDateTimeString } from "../../helpers/GetStaticData";
function LogsAndNotificationsTable({ errorCount, setErrorCount, isMinimized }) {
const tableRef = useRef(null);
@@ -23,7 +24,7 @@ function LogsAndNotificationsTable({ errorCount, setErrorCount, isMinimized }) {
}
return {
key: `${log.timestamp}-${uniqueId()}`,
- time: log?.timestamp,
+ time: getDateTimeString(log?.timestamp),
level: log?.level,
type: log?.type,
stage: log?.stage,
diff --git a/frontend/src/store/socket-logs-store.js b/frontend/src/store/socket-logs-store.js
index bf4cfd173..f4cd62a22 100644
--- a/frontend/src/store/socket-logs-store.js
+++ b/frontend/src/store/socket-logs-store.js
@@ -2,7 +2,6 @@ import { create } from "zustand";
import { useSessionStore } from "./session-store";
import axios from "axios";
-import { getDateTimeString } from "../helpers/GetStaticData";
const STORE_VARIABLES = {
logs: [],
@@ -16,7 +15,7 @@ const useSocketLogsStore = create((setState, getState) => ({
let logsData = [...(existingState?.logs || [])];
const newLogs = messages.map((msg, index) => ({
- timestamp: getDateTimeString(msg?.timestamp),
+ timestamp: msg?.timestamp,
key: logsData?.length + index + 1,
level: msg?.level,
stage: msg?.stage,