decentraland/kernel-legacy

System messages are sent to scene before being ready

moliva opened this issue · 5 comments

When loading a scene, system messages are sent before the scene ready message is received.

This doesn't happen in every case. Could be due to a race condition.

@moliva what's the status of this?

Still doing a bit of research to find out when this is actually happening.

I'm going to explain the expected behavior for a piece of code to identify better the issue:

const cube = new Entity()

class RotatorSystem { 
  // this system rotates(transform) every entity on it
  update() { ... }
}

engine.addSystem(new RotatorSystem).add(cube)

The expected message order is:

# scene bootstrap
- CreateEntity
- SceneStarted / Ready
# here the update loop starts
- UpdateEntityComponent
- ...
- UpdateEntityComponent

Is this issue related to that behavior?

It is. Seems that messages were not sent or processed in a correct manner so we got cases were these were they were an update seemed to be received before the scene was actually ready.

Cannot reproduce.