using is_up_to_date cached outside of the fence was causing a race condition where the same sync could be kicked off again (#2433)

This commit is contained in:
rkuo-danswer
2024-09-14 23:27:05 -07:00
committed by GitHub
parent a51b0f636e
commit 3c934a93cd

View File

@@ -274,6 +274,8 @@ def try_generate_document_set_sync_tasks(
return None return None
# don't generate sync tasks if we're up to date # don't generate sync tasks if we're up to date
# race condition with the monitor/cleanup function if we use a cached result!
db_session.refresh(document_set)
if document_set.is_up_to_date: if document_set.is_up_to_date:
return None return None
@@ -316,6 +318,8 @@ def try_generate_user_group_sync_tasks(
if r.exists(rug.fence_key): if r.exists(rug.fence_key):
return None return None
# race condition with the monitor/cleanup function if we use a cached result!
db_session.refresh(usergroup)
if usergroup.is_up_to_date: if usergroup.is_up_to_date:
return None return None