Is handleInternalMessage Synchronous?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

harish2992
Posts: 2
Joined: 02 Jan 2017, 11:42

Is handleInternalMessage Synchronous?

Postby harish2992 » 05 Jul 2017, 10:25

I have 2000 rooms running concurrently in my system where users are joined. I need to send command in every room in every 1 second to update some properties. These properties can be database stuff, hitting external REST APIs or some variables.

As of now, I'm iterating over room list and sending commands via handleInternalMessage of room extension to all the rooms. But it seems to be a synchronous activity as I can return data from room extension and can read from where I called.

Is it the good way to implement this or any other way through which I can send commands to all the rooms in every 1 second simultaneously.

Please assist.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Is handleInternalMessage Synchronous?

Postby Lapo » 05 Jul 2017, 14:13

Hi,
harish2992 wrote:As of now, I'm iterating over room list and sending commands via handleInternalMessage of room extension to all the rooms. But it seems to be a synchronous activity as I can return data from room extension and can read from where I called.

Yes, it is synchronous.

Is it the good way to implement this or any other way through which I can send commands to all the rooms in every 1 second simultaneously.

Well, if you have DB or HTTP calls they will hold the current thread for as long as they need to run and the process of repeating it 2000 times will take quite a while.
Imagine each call takes 300ms x 2000 = 600K msec => 10 minutes!

I think there are better ways to do this, but I might not be able to see the full picture here, so I might be wrong.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: heroumi and 47 guests