Skip to content

Commit

Permalink
fix: deadlock in notion getParents (#8813)
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Fontanier <[email protected]>
  • Loading branch information
fontanierh and Henry Fontanier authored Nov 21, 2024
1 parent b6a9b2b commit 8afd6bb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions connectors/src/connectors/notion/lib/parents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,29 @@ async function _getParents(
return parents;
case "page":
case "database": {
if (seen.includes(pageOrDbId)) {
seen.push(pageOrDbId);
if (!pageOrDb.parentId) {
logger.error(
{
connectorId,
pageOrDbId,
seen,
parentId: pageOrDb.parentId,
},
"getParents infinite loop"
"getParents parentId is undefined"
);
return parents.concat(seen);
throw new Error("getParent parentId is undefined");
}
seen.push(pageOrDbId);
if (!pageOrDb.parentId) {
if (seen.includes(pageOrDb.parentId)) {
logger.error(
{
connectorId,
pageOrDbId,
seen,
parentId: pageOrDb.parentId,
},
"getParents parentId is undefined"
"getParents infinite loop"
);
throw new Error("getParent parentId is undefined");
return parents.concat(seen);
}
if (onProgress) {
await onProgress();
Expand Down

0 comments on commit 8afd6bb

Please sign in to comment.