If I understand you correctly, each minute you want a given "set" of
things to happen (say, six things) at various times throughout the
minute (not all at once), and only after all six of those things
happen should the next "set" of things happen for the next minute; if
one of the previous set hasn't happened yet, the next set shouldn't

To guarantee the behavior you've described, you'll have to have
coordination between the sets. Even if you tried (for instance) to
make sure all six things happened within 40 seconds and set up a one-
minute timer to kick them off, you still couldn't be guaranteed (even
with that 20-second buffer) that there wouldn't be overlap.

Prototype doesn't have anything out of the box that does that, you'll
have to build it from the pieces provided.

FWIW: I wouldn't use PeriodicalExecuter when building your solution to
this unless timing is almost completely unimportant. PE relies on
setInterval, and setInterval has some interesting and implementation-
specific behaviors. Here are two I know about:

1. If the callback from the previous event hasn't completed by the
time the next event is supposed to fire, the event is skipped
entirely. So for instance, if you have an interval of 500ms, you
should get callbacks at *roughly* +500ms, +1000ms, +1500ms, +2000ms,
etc. But if the callback runs for 600ms the second time it runs (at
+1000ms), the +1500ms event will be skipped entirely. (Not just
delayed until the interpreter is free, actually skipped.) Only some
implementations do this (IE is one of them).

2. Separately, there's also a discrepancy between implementations
about when the interval starts (some implementations start counting
after your callback completes, others don't). So if your callback runs
in 200ms on average, on IE (for example) it'll run at +500, +700,
+1400, etc., whereas on Chrome (for example) it'll run at +500, +1000,
+1500, etc.

T.J. Crowder
Independent Software Consultant
tj / crowder software / com

So I think I'd probably use setTimeout (or Function#delay) instead,
and have each event schedule the next occurrence of the event

On Jul 22, 11:35 am, deepa balu <deepabal...@gmail.com> wrote:
> In my project client/server communication is happening through
> webservice calls.
> For that i should run more than one(ex:6) PeriodicalExecuter in every
> minute.My issue is that, PeriodicalExecuter are keep on calling
> without finishing the call of first one.
> I want to run a single set of PeriodicalExecuter's at a time.
> For Ex: If all the six PeriodicalExecuter are running then the next
> set of PeriodicalExecuter should start after the completion of the
> prevoius set of PeriodicalExecuter's.

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to