mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-06 12:19:50 +00:00
Fix issue with overlapping site resources not sending
This commit is contained in:
@@ -582,10 +582,17 @@ async function rebuildClientAssociationsFromSiteResourceImpl(
|
|||||||
? mergedAllClientIds
|
? mergedAllClientIds
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
|
// Note: we deliberately do NOT exclude clients covered by another
|
||||||
|
// site resource here (unlike clientSitesToRemove below). Doing so
|
||||||
|
// previously caused a permanent gap: if resource A saw resource B's
|
||||||
|
// cache row and skipped adding (assuming B would maintain it), and
|
||||||
|
// B's own rebuild made the same assumption about A, the site-level
|
||||||
|
// row could end up never inserted by anyone even though both
|
||||||
|
// resources' client associations were otherwise correct.
|
||||||
|
// onConflictDoNothing makes a redundant insert harmless, so there's
|
||||||
|
// no correctness reason to skip here.
|
||||||
const clientSitesToAdd = expectedClientIdsForSite.filter(
|
const clientSitesToAdd = expectedClientIdsForSite.filter(
|
||||||
(clientId) =>
|
(clientId) => !existingClientSiteIds.includes(clientId)
|
||||||
!existingClientSiteIds.includes(clientId) &&
|
|
||||||
!otherResourceClientIds.has(clientId) // dont add if already connected via another site resource
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const clientSitesToInsert = clientSitesToAdd.map((clientId) => ({
|
const clientSitesToInsert = clientSitesToAdd.map((clientId) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user