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

Optimization #267

Closed
vivimage opened this issue Nov 18, 2024 · 3 comments
Closed

Optimization #267

vivimage opened this issue Nov 18, 2024 · 3 comments

Comments

@vivimage
Copy link

Is it possible to optimize this?

If I upload 600 pages the process is taking around 3 hours and most of the time fail

Do not process already created pages for example?

@HEIGE-PCloud
Copy link
Owner

HEIGE-PCloud commented Dec 15, 2024

There are some caching logic, but I am not sure they work properly.

The main challenge for caching is how to handle images and files. The links for images and files provided by Notion expires in 1 hour. So we need to either regenerate those links every hour (the current approach) or store these files somewhere else (less ideal).

@HEIGE-PCloud
Copy link
Owner

I think the best solution is to have some lightweight serverless function that regenerates these links on demand. So for the HTML we render, we call our custom API endpoint

<img src="https://image-api.com/image-id>

And in the API, we either call Notion API to generate an image link and forward the request there, or if we have generated a link recently then directly return that one.

The only problem is that this makes the deployment a bit more complicated, but it does allows us to cache everything simply by checking the last_update_time on every post.

@HEIGE-PCloud
Copy link
Owner

Ok this is implemented, the deployment process is changed. Redeploy by following the README and let me know if there are any problems.

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

No branches or pull requests

2 participants