Closed jonathanperret closed 7 years ago
But I'd still want to allow multiple programmers and/or renderers to be open on a "new" playground, and still be synchronized,
is that because you want them to be ready to receive the first code object?
It's because if a Playground
does not exist in the World
when another client comes in (even just the preview from the first programmer), it will not find the requested playground and create a new one!
Currently, if you go to http://paysage.xyz you get redirected to a newly created playground with a randomly chosen name.
It used to be the case that until you posted some code to the playground, it would not appear in the playground list (
http://paysage.xyz/list
). Unfortunately, at some point when refactoring the server-side playground handling, we made it so that playgrounds now appear as soon as a programmer or renderer connect to them.This results in a long list of empty playgrounds in
/list
: one for each random visit topaysage.xyz
(thankfully, it requires a visit with a full browser to trigger playground creation, otherwise there would be even more empty playgrounds created by searchbots).Ideally, playgrounds would not even exist server-side until some code is posted. But I'd still want to allow multiple programmers and/or renderers to be open on a "new" playground, and still be synchronized, which is not trivial to do in the current architecture (we used to create a Socket.IO room for each playground which made it work, but the playground is now doing the synchronization, which is simpler).
So, we could avoid listing empty playgrounds in
/list
. Or we could garbage-collect empty playgrounds which don't have any client connected.