midudev / javascript-100-proyectos

100 proyectos de JavaScript con código y vídeos. ¡Gratis!
https://javascript100.dev
Other
2.24k stars 230 forks source link

Fix Cloudflare rate limit issue #47

Closed Ruminini closed 4 months ago

Ruminini commented 5 months ago

Fix Cloudflare rate limit issue

Description

Arkanoid was triggering multiple location.reload() calls on game over, which caused a Cloudflare rate limit. Added a gameOver boolean to prevent frames from being drawn once the game is over.

Steps to Reproduce the Bug

  1. Open the Arkanoid Game. (If you are just opening the index.html file locally, you might need to add a timeout to the location.reload() to mimic the effect of a slower server)
  2. Open the developer tools console.
  3. Hold the left or right arrow key when the game starts.
  4. Once you lose the game, multiple "Game Over" messages are logged into the console (the amount may vary depending on internet or computer speed).
  5. If enough reloads were sent, you'll encounter a Cloudflare Error 1015 "You are being rate limited." Cloudflare Error Screenshot
vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
javascript-100-proyectos ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2024 0:17am