Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: add hard limit on notion db size allowed to be turned into CSV. ContinueAsNew each time #7444

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

Fraggle
Copy link
Contributor

@Fraggle Fraggle commented Sep 17, 2024

Description

Some customers have very large notion DB. We now have a hard limit of 256mb to allow them to be turned into CSV.
Use raw data fetching by chunk of 250 items to limit memory usage.
Removed the 32 iterations before continuing as new to simplify.

Risk

Should be harmless.

Deploy Plan

Deploy connectors

@Fraggle Fraggle force-pushed the 1337-add-hard-limit-for-notion-database-import-size branch 2 times, most recently from a6772b2 to af1dae9 Compare September 17, 2024 08:43
@Fraggle Fraggle force-pushed the 1337-add-hard-limit-for-notion-database-import-size branch from af1dae9 to bc15b7a Compare September 17, 2024 08:45
Copy link
Contributor

@fontanierh fontanierh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. One small suggestion

const pagesProperties = pageCacheEntries.map(
(p) => JSON.parse(p.pagePropertiesText) as PageObjectProperties
);
let pagesProperties: PageObjectProperties[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could also avoid holding onto this entirely by generating smaller CSVs as you go through the chunks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I was going for initially but:

  • there is some header management to do if I have several small csv
  • in the end, the text would be turned into text (as csv) in memory anyway, I wouldn't be saving anything :(

@@ -120,164 +114,152 @@ export async function notionSyncWorkflow({

const isInitialSync = !lastSyncedPeriodTs;

do {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks 🙏

@Fraggle Fraggle merged commit 1fd62cf into main Sep 17, 2024
3 checks passed
@Fraggle Fraggle deleted the 1337-add-hard-limit-for-notion-database-import-size branch September 17, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants