in reply to How to emulate queue for CGI script?

I'd put the logic in the browser. You're already using Ajax, so Javascript is already enabled. It could go something like this.

Replies are listed 'Best First'.
Re^2: How to emulate queue for CGI script?
by thargas (Deacon) on Mar 21, 2011 at 15:04 UTC

    There is a problem with trying to do the rate-limiting in the browser: if there is more than one client, you'll blow the limit. I think it has to be done in the back-end.

    You ought to be able to get the effect you want by using CPAN modules. You may be able to simply use HTTP::Cache::Transparent.

      thargas,
      Perhaps you missed where the CGI checks how long it has been since a request was made? That will be for all clients. The trouble I see with it is a race condition where two clients check at the same time and both think it is ok. One actually gets delivered and the other gets queued with no notice to the user. I am sure that since we are doing whiz bang AJAX that we could tell the user the approximate wait time even after they are in the queue though.

      Cheers - L~R

Re^2: How to emulate queue for CGI script?
by Gangabass (Vicar) on Mar 21, 2011 at 16:33 UTC
    Thank you for idea. Here is code i have now: