Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

Invalidate tasks queries immediately after sync

Edwin Jose51081d17e870
diff --git a/.cursor/debug.log b/.cursor/debug.log
deleted file mode 100644
index 6855bbaed..000000000
--- a/.cursor/debug.log
+++ /dev/null
@@ -1,11 +0,0 @@
-{"hypothesisId":"H3","location":"chunks/page.tsx:AccessControl","message":"chunks page fileData ACL","data":{"filename":"sample_doc.docx.docx","owner":"107549107036797017082","allowed_users_len":3,"allowed_groups_len":0,"showAccessControl":true},"timestamp":1770799353369}
-{"hypothesisId":"H3","location":"chunks/page.tsx:AccessControl","message":"chunks page fileData ACL","data":{"filename":"sample_doc.docx.docx","owner":"107549107036797017082","allowed_users_len":3,"allowed_groups_len":0,"showAccessControl":true},"timestamp":1770799353371}
-{"hypothesisId":"H3","location":"chunks/page.tsx:AccessControl","message":"chunks page fileData ACL","data":{"filename":"sample_doc.docx.docx","owner":"107549107036797017082","allowed_users_len":3,"allowed_groups_len":0,"showAccessControl":true},"timestamp":1770799353373}
-{"hypothesisId":"H3","location":"chunks/page.tsx:AccessControl","message":"chunks page fileData ACL","data":{"filename":"sample_doc.docx.docx","owner":"107549107036797017082","allowed_users_len":3,"allowed_groups_len":0,"showAccessControl":true},"timestamp":1770799353374}
-{"hypothesisId":"H3","location":"chunks/page.tsx:AccessControl","message":"chunks page fileData ACL","data":{"filename":"sample_doc.docx.docx","owner":"107549107036797017082","allowed_users_len":3,"allowed_groups_len":0,"showAccessControl":true},"timestamp":1770799353390}
-{"hypothesisId":"H3","location":"chunks/page.tsx:AccessControl","message":"chunks page fileData ACL","data":{"filename":"sample_doc.docx.docx","owner":"107549107036797017082","allowed_users_len":3,"allowed_groups_len":0,"showAccessControl":true},"timestamp":1770799353391}
-{"hypothesisId": "H1", "location": "search_service.py:chunks", "message": "backend chunk ACL sample", "data": {"chunk_samples": [{"filename": "openrag-documentation.pdf", "owner": false, "allowed_users_len": 0, "allowed_groups_len": 0}, {"filename": "openrag-documentation.pdf", "owner": false, "allowed_users_len": 0, "allowed_groups_len": 0}, {"filename": "openrag-documentation.pdf", "owner": false, "allowed_users_len": 0, "allowed_groups_len": 0}, {"filename": "openrag-documentation.pdf", "owner": false, "allowed_users_len": 0, "allowed_groups_len": 0}, {"filename": "openrag-documentation.pdf", "owner": false, "allowed_users_len": 0, "allowed_groups_len": 0}]}, "timestamp": 1770799353773.2039}
-{"hypothesisId":"H5","location":"useGetSearchQuery.ts:firstChunk","message":"API first chunk ACL","data":{"filename":"openrag-documentation.pdf","hasOwner":false,"allowed_users_len":0,"allowed_groups_len":0},"timestamp":1770799353784}
-{"hypothesisId":"H2","location":"useGetSearchQuery.ts:firstFile","message":"aggregated file ACL","data":{"filename":"openrag-documentation.pdf","owner":null,"allowed_users_len":0,"allowed_groups_len":0},"timestamp":1770799353785}
-{"hypothesisId":"H3","location":"chunks/page.tsx:AccessControl","message":"chunks page fileData ACL","data":{"filename":"sample_doc.docx.docx","owner":"107549107036797017082","allowed_users_len":3,"allowed_groups_len":0,"showAccessControl":true},"timestamp":1770799353789}
-{"hypothesisId":"H3","location":"chunks/page.tsx:AccessControl","message":"chunks page fileData ACL","data":{"filename":"sample_doc.docx.docx","owner":"107549107036797017082","allowed_users_len":3,"allowed_groups_len":0,"showAccessControl":true},"timestamp":1770799353791}
diff --git a/frontend/app/api/mutations/useSyncConnector.ts b/frontend/app/api/mutations/useSyncConnector.ts
index e87f92a17..dc3d48b67 100644
--- a/frontend/app/api/mutations/useSyncConnector.ts
+++ b/frontend/app/api/mutations/useSyncConnector.ts
@@ -54,10 +54,8 @@ export const useSyncAllConnectors = () => {
return useMutation({
mutationFn: syncAllConnectors,
onSettled: () => {
- // Invalidate and refetch search queries after a delay to allow sync to complete
- setTimeout(() => {
- queryClient.invalidateQueries({ queryKey: ["search"] });
- }, 2000);
+ // Immediately refetch tasks so new sync jobs appear in the task list
+ queryClient.invalidateQueries({ queryKey: ["tasks"], exact: false });
},
});
};
@@ -68,10 +66,8 @@ export const useSyncConnector = () => {
return useMutation({
mutationFn: syncConnector,
onSettled: () => {
- // Invalidate and refetch search queries after a delay to allow sync to complete
- setTimeout(() => {
- queryClient.invalidateQueries({ queryKey: ["search"] });
- }, 2000);
+ // Immediately refetch tasks so new sync jobs appear in the task list
+ queryClient.invalidateQueries({ queryKey: ["tasks"], exact: false });
},
});
};