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

Search: the Refresh Redis button times out #67

Open
deanmoses opened this issue Dec 30, 2023 · 0 comments
Open

Search: the Refresh Redis button times out #67

deanmoses opened this issue Dec 30, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@deanmoses
Copy link
Owner

deanmoses commented Dec 30, 2023

On prod, clicking the sveltekit app's Reset Redis button eventually errors out because it takes longer than the 30 second time limit on the API Gateway. So it looks like it fails from the front end, but in fact the refresh succeeds on the back end.

Implementation Notes

I've already tried the push notification thing and decided it's for the birds. So instead I'd keep the refresh state/status somewhere, like in some database, and poll for it in the sveltekit client.

Each refresh invocation might be given an ID, which the lambda returns to the client, and the state for that refresh ID would be something like IN_PROGRESS, ERROR, COMPLETE. If there's already another refresh ID IN_PROGRESS, the lambda doesn't allow starting another.

I could keep the refresh status in a DynamoDB table, but a possibly better option is CloudFront KeyValueStore. It's built to be read from by CloudFront Functions and thus would be super fast. It'd work like this:

  • The Redis reset lambda would check the KeyValueStore to see if there's already a refresh in progress.
  • If not, the Redis reset lambda would generate some random ID for the refresh ID and update the KeyValueStore reset entry with that ID and status IN_PROGRESS.
  • The Redis reset lambda would send some sort of refresh event, like a SNS topic, that another lambda will handle (see below).
  • The Redis reset lambda would finish by returning that ID to the client
  • Another lambda would be triggered by the SNS topic and do the actual refresh.
  • When finished, that lambda would set the refresh state in the KeyValueStore to COMPLETE or ERROR.
@deanmoses deanmoses added the enhancement New feature or request label Dec 30, 2023
@deanmoses deanmoses changed the title Refresh button times out Redis refresh button times out Dec 30, 2023
@deanmoses deanmoses changed the title Redis refresh button times out Search: Redis refresh button times out Dec 31, 2023
@deanmoses deanmoses changed the title Search: Redis refresh button times out Search: the Refresh Redis button times out Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant