What does the Glitch waking up / starting screen actually do?

Whilst I was testing a vulnerability on Glitch I noticed that the proxy decided to show me the waking/loading screen and thus “wake up” the project. However, the project was already awake and started, so why would the proxy show me this?

This is the source code I used for the application:

// Imports
const Express = require("express");

// Create an express application
const app = Express();

// A list of all the requests that has been sent to the server since boot.
const requests = [ ];

// Add an entry to the requests array.
const requested = () => requests.push(Date.now());

// Calculate the amount of requests that has been sent the past hour.
const calc = (since = Date.now()) => requests.filter(entry => entry > since - 3600000).length;

// Get the amount of seconds since last request.
const last = (since = Date.now()) => requests.length < 1 ? -1 : Math.floor((requests[requests.length - 1] - since) / 1000);

// A / route
app.get("/", async (req, res) => {
	// Add an entry to the requests array.
	// Respond with a JSON object.
		seondsSinceLastRequest: last(),
		requestsThisHour: calc()

When the loading screen finished it should have given me 1 in the second array item, not 35k+ as shown in the video. The fact that the second item returned 35k+ means that the app must’ve already been running, otherwise it wouldn’t have any requests stored in memory. Why was the loading screen shown?

1 Like

Yeah, I have noticed this too. When editing a project with a backend, and sometimes (50% probability) in the preview while the app is still running, I get the waking up screen.

Indeed, I should’ve included this in the email I just sent to jenn :joy:

1 Like

Maybe because of using Express? Glitch probably understood it needed to be built. But I sometimes get shown the screens for my entirely static sites, too!

Wait, what? :thinking:  

If I quickly make a change in the editor and go back to my project and reload, I get the starting screen when I shouldn’t. I’ve always understood this to be the project reloading and therefore I should wait for the container or whatever to reload, so it shows me the starting screen for a few seconds.

1 Like