Skip to content

Commit

Permalink
fix: remove where clause from notion GC (#6565)
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 Jul 29, 2024
1 parent 1b0e776 commit d1975cc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions connectors/src/connectors/notion/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,7 @@ export async function garbageCollect({
do {
// Find the resources not seen in the GC run (using runTimestamp).
resourcesToCheck = await findResourcesNotSeenInGarbageCollectionRun(
connector.id,
runTimestamp
connector.id
);

const NOTION_UNHEALTHY_ERROR_CODES = [
Expand Down Expand Up @@ -1074,8 +1073,7 @@ export async function deletePageOrDatabaseIfArchived({
}

async function findResourcesNotSeenInGarbageCollectionRun(
connectorId: ModelId,
runTimestamp: number
connectorId: ModelId
): Promise<
Array<{
lastSeenTs: Date;
Expand Down Expand Up @@ -1114,10 +1112,8 @@ async function findResourcesNotSeenInGarbageCollectionRun(
await NotionPage.findAll({
where: {
connectorId,
lastSeenTs: {
[Op.lt]: new Date(runTimestamp),
},
},
order: [["lastSeenTs", "ASC"]],
attributes: ["lastSeenTs", "notionPageId", "skipReason"],
limit: pageSize,
})
Expand All @@ -1142,10 +1138,8 @@ async function findResourcesNotSeenInGarbageCollectionRun(
await NotionDatabase.findAll({
where: {
connectorId,
lastSeenTs: {
[Op.lt]: new Date(runTimestamp),
},
},
order: [["lastSeenTs", "ASC"]],
attributes: ["lastSeenTs", "notionDatabaseId", "skipReason"],
limit: pageSize,
})
Expand Down

0 comments on commit d1975cc

Please sign in to comment.