This is a thread for random discussions that gets posted everyday at 5am central.
Tell us what you're doing today, ask questions, or vent about your life. Whatever you want, let it rip!
pull down to refresh
This is a thread for random discussions that gets posted everyday at 5am central.
Tell us what you're doing today, ask questions, or vent about your life. Whatever you want, let it rip!
Working on social media previews today. Currently when twitter/telegram/mastodon/etc request the little page preview I spin up a headless chome browser and screenshot the page - all inline and on demand. This has problems:
For awhile, this was DOSing SN until I put a rate limiter on it. That's not ideal though because:
Instead what I want to do is transactionally queue a job to screenshot the page every time a post/page is updated, store the image in block storage (e.g. S3), and serve that. One problem with this is determining when to screenshot non-post pages like the homepage, recent, user profiles, top, etc. I guess I can daily screenshot those pages but it's relatively inelegant.
Why not just cache the generated images but still generate them on demand?
btw, I am doing the exact same thing on bitcoininflationindex.com. I use netlify for my frontend and use their "On-demand builders" to generate images which are cached on the edge.
https://docs.netlify.com/configure-builds/on-demand-builders/
Works perfect for this use-case. You could spin up a netlify microservice specifically for this purpose and run it separate from the site.
Here is my code for reference: https://gist.github.com/theshanergy/42fd16010cc968b47f93df1a5413a6f1
That’s an option I’m thinking about. I don’t use netlify but I could do something like this with AWS lambda.
deleted by author
deleted by author
deleted by author
Alternatives ...
deleted by author
deleted by author
deleted by author