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

[0XP-1481] investigate caching one-click-preview page #2070

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ichub
Copy link
Contributor

@ichub ichub commented Oct 30, 2024

summary

  • I think this PR basically implements caching for the one-click preview page, as long as it's actually proxied through the same host that hosts the zupass client (since the way I've implemented this was on top of the existing service worker infra).
  • I've tested this locally and am pretty sure it works.
  • I'd like for this to be tested on a staging server, along with the pass-through proxy for one click pages, prior to being confident that this is implemented properly.
    • This probably means I'd like to hand this off to someone else to finish up.

details

  • to facilitate local development, I edited passport-client's build script to not only serve the built zupass client's build artifacts, but also to forward requests to the generic-issuance backend for requests to localhost:3000/one-click-preview/..., similarly to how that forwarding will be done in production and currently is done on staging-richard
    • if you append ?slow to a one-click preview URL (in local dev only), this build script will deliberately sleep for 30s prior to returning a response. this can be used to test that the service worker actually did cache that preview page. the way that the caching works is that if the request to the one-click preview url takes longer than 5 seconds to load, it'll attempt to load the page from the cache. I've verified that this works locally - preview pages with the ?slow suffix hang for 5 seconds, then render, despite the actual request taking 30s.
  • I edited the one click preview html on the podbox backend to include a script that loads and registers the same service worker that the normal zupass client does.
  • I edited the service worker itself to be able to receive messages posted from the application's webpage. invoke that api on the one click preview page to cache itself, so that that particular preview page is cached in the service worker's ephemeral cache.

@rrrliu rrrliu changed the title [wip] investigate caching one-click-preview page [0XP-1481] [wip] investigate caching one-click-preview page Oct 30, 2024
Copy link

linear bot commented Oct 30, 2024

@ichub ichub force-pushed the ivan/cache-one-click-page branch 4 times, most recently from dcc1bd2 to 0b9a09e Compare October 30, 2024 04:41
@ichub ichub changed the title [0XP-1481] [wip] investigate caching one-click-preview page [0XP-1481] investigate caching one-click-preview page Oct 30, 2024
@ichub ichub marked this pull request as ready for review October 30, 2024 04:56
@ichub ichub requested a review from rrrliu October 30, 2024 04:56
@rrrliu rrrliu requested a review from artwyman November 6, 2024 02:25
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.

1 participant