I'm working on a script that, in order to reduce server load, should 
synchronize between multiple instances that can appear in multiple pages.

The idea is to have:
User opens tabs A,B,C,D. Each one has an instance of the script.

The user start the processing in the tabs A, B, C, D (just assume about 1s 
delay between each other and that they are in that order).

The whole process to assist the user in gathering some data from the server 
and from connections related to the server.
Multiple requests are required for each thing and that takes some time.

In order to save on server load, my idea is to have B waiting for A to 
finish, C waiting for B to finish and D waiting for C to finish. It is also 
part of the idea to not rely on the server for this synchronization work as 
it would use load to do some work that should be possible to do without the 
server's intervention.

My current problem is to synchronize all these so that D goes after C that 
goes after B that goes after A. While not forgetting that if the tab B is 
closed after A is complete, C should start (do not make infinite waits for 
B to complete). Also, if B is closed while working, C starts working and D 
continues to wait.

I've been trying this with localstorage and the "storage" event and 
timeouts (with also heartbeats) but I'm having issues with infinite loops 
and with scripts running in the background. Any ideas?


Even if not true, please assume that there is no alternative to doing the 
said requests to the server.

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to