Skip to content

Commit

Permalink
padawan - settimeout to keep container alive while user is on page
Browse files Browse the repository at this point in the history
  • Loading branch information
dcordz committed Jun 6, 2024
1 parent a15c33d commit be9fb33
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@
// Make the VAPID public key available to the client as a string
window.VAPID_PUBLIC_KEY = "<%= ENV['VAPID_PUBLIC_KEY'].delete('=') %>"
</script>
<script>
// Hit the backend every 4.95 minutes to ensure uptime while a user is on the page
window.setTimeout(() => {
fetch("/up").then(() => null).catch(console.error)
}, 1000 * 60 * 4.95)
</script>
</html>

0 comments on commit be9fb33

Please sign in to comment.