Skip to content

Conversation

shepmaster
Copy link
Member

This helps prevent a rare suboptimal case where a visitor to the
playground triggered the crates / versions request but then left the
site before the request finished, resulting in the request being
canceled and the work being wasted without being cached. This mostly
showed up when running heavy load tests locally to try and suss out
other bugs.

Other benefits:

  • This will also result in reduced contention when multiple requests
    would have triggered a cache refresh. Only one computation should
    occur.

  • The cache value is now computed out-of-band and requests should not
    block on it.

Tools like rustfmt and rust-analyzer don't like a lot of stuff in the
body of a macro, so we use the macro just to construct an ad-hoc enum
of the choices and leave most code outside.
This helps prevent a rare suboptimal case where a visitor to the
playground triggered the crates / versions request but then left the
site before the request finished, resulting in the request being
canceled and the work being wasted without being cached. This mostly
showed up when running heavy load tests locally to try and suss out
other bugs.

Other benefits:

- This will also result in reduced contention when multiple requests
  would have triggered a cache refresh. Only one computation should
  occur.

- The cache value is now computed out-of-band and requests should not
  block on it.
@shepmaster shepmaster added the maintenance Keeping the wheels turning label Nov 24, 2024
@shepmaster shepmaster merged commit 97331e5 into main Nov 24, 2024
12 checks passed
@shepmaster shepmaster deleted the cache-rework branch November 24, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Keeping the wheels turning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant