News for hackers. Stuff that matters.
Re:WikiTok by aizk on Tuesday February 04, 2025 @03:52PM (#42938463)
The only caveat I feel is that the speed of the API is definitely not comparable to something more purpose built for this kind of scale, but overall I'm happy as it works well enough that I don't have to think about it too hard.
Re:WikiTok by mikedelfino on Tuesday February 04, 2025 @03:58PM (#42938559)
I think Github Actions could be used for scheduled builds, so that the initial load would have random articles right in. Further requests could then be made in advance so users would not notice any delay from the API.
Re:WikiTok by aizk on Tuesday February 04, 2025 @05:29PM (#42939936)
Do you have any examples of that I can look at as a reference? I'm used to github actions just being my CI/CD build step checking tool.
Re:WikiTok by mikedelfino on Tuesday February 04, 2025 @08:17PM (#42942098)
I attempted to implement the schedule trigger [1] on GitHub Actions as an example, but it is not being triggered as I expected. It needs more digging if you're so inclined.

Aside from that, the whole gist is that the initial data can be injected into the static files during the build step, or even saved as separate JSON files that the app can load instead of reaching out to the API. As long as you're willing to refresh the static data from time to time, of course.

I created a basic example at https://schedbuild.pages.dev/ with a rough, manual implementation of a build step. Frameworks like Next.js offer a more sophisticated approach that can render the entire HTML, allowing users to load the static page with the initial data already rendered without Javascript, and subsequent interactions taking over from there more seamlessly.

If the Github Actions schedule feature is ever sorted out, in my opinion it's a reasonable alternative to setting up a backend just for this.

[1] https://docs.github.com/en/actions/writing-workflows/choosin...

Re:WikiTok by jahsome on Tuesday February 04, 2025 @09:52PM (#42943078)
in lieu of a cron server, I use scheduled jobs without any issues for a few production workloads on azure devops (AKA gh actions 0.1).
Re:WikiTok by mikedelfino on Wednesday February 05, 2025 @03:36AM (#42945705)
You're right. I just checked the example project now and it's been updated hourly since then. It's just slightly delayed.
Re:WikiTok by mikedelfino on Wednesday February 05, 2025 @03:35AM (#42945694)
Edit to the other comment: the cron job wasn't being triggered at first, but turns out it's just slightly delayed. The example has been updated hourly since then.

You can use a schedule trigger [1] on GitHub Actions.

The whole gist is that the initial data can be injected into the static files during the build step, or even saved as separate JSON files that the app can load instead of reaching out to the API. As long as you're willing to refresh the static data from time to time, of course.

I created a basic example at https://schedbuild.pages.dev/ with a rough, manual implementation of a build step. Frameworks like Next.js offer a more sophisticated approach that can render the entire HTML, allowing users to load the static page with the initial data already rendered without Javascript, and subsequent interactions taking over from there more seamlessly.

In my opinion this is a reasonable alternative to setting up a backend just for this.

[1] https://docs.github.com/en/actions/writing-workflows/choosin...

Re:WikiTok by bawolff on Wednesday February 05, 2025 @10:07AM (#42949475)
Could you just preload the next few entries before the user swipes?