[dancer-users] Non-blocking stuff

David H untg99 at gmail.com
Fri Jan 8 13:39:23 GMT 2016


On Sat, Dec 26, 2015 at 8:27 PM, Sawyer X <xsawyerx at gmail.com> wrote:

> I've been pretty busy of late so had no time to keep track of the
> list. My apologies.
>
> Still, I would be happy to try and resolve this.
>
> Since this was last month, I'm assuming there might have been changes.
> Can you tell me what the last current state (plus some code, please)
> of this is? We'll pick it up from the current state and try and
> resolve any issues.
>
>
I guess the basic issue that happens is what is described above and for
some reason for me, Starman doesn't seem to solve it.
A basic example I will give is this, and keep in mind, this is a single
user, not multiple at this stage.

   - Load up the home page of the website, there are processes that run
   that might take 4-5 seconds to complete in the background (using jquery)
   (let's call it /LoadPage).
   - The I click on a page to generate a report (say /LoadReport), however,
   the report waits for /LoadPage to fully complete before starting (on the
   server side, I can see the client sending through the request immediately),
   thus it is completely blocking. It seems to do this even when running
   through Starman.

I'm not sure if there is a way (or if this even makes sense) to fork out
each request so the dancer site isn't just sitting there waiting for the
last thing to complete.

I tried using the Delayed responses (Async/Streaming) listed here:

https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#Delayed-responses-Async-Streaming

But for some reason, maybe because it is solving a problem that I don't
specifically have, it didn't seem to help.

Also, I pretty much all the time run with -R (or the equivalent restart
switch for plackup/starman) so the site restarts without me having to
intervene if any of the files get modified, I'm not sure if that factors
into the forking issue I have.

Thanks,

David


>
> On Tue, Nov 17, 2015 at 8:55 AM, David H <untg99 at gmail.com> wrote:
> > Thanks Warren,
> >
> > I could fiddle with it, I've spent a good 30 mins to 1 hour trying to get
> > various versions of the code working without success. I can attest the
> the
> > 'streaming' part works fine and the code will stream properly (I even
> > cracked out Wireshark to test), however it still blocks. In terms of the
> > non-blocking part, I'm sure there is something fundamental I'm doing
> wrong,
> > just not sure what.
> >
> > David
> >
> >
> > On Tue, Nov 17, 2015 at 2:50 PM, Warren Young <wyml at etr-usa.com> wrote:
> >>
> >> On Nov 16, 2015, at 9:09 PM, David H <untg99 at gmail.com> wrote:
> >> >
> >> > So yeah, some clarification would be awesome, or just someone with an
> >> > example which works.
> >>
> >> One of the items on the list of ideas for Advent Calendar 2015 articles
> is
> >> exactly that:
> >>
> >>   https://github.com/PerlDancer/advent-calendar
> >>
> >> Since no one has signed up to write that article, maybe you should.  I
> >> know you don’t know how to make it work right now, but the code is
> open, so
> >> you could in principle figure out how to use it.
> >>
> >> An article written from the perspective of a newbie is often better in
> the
> >> end than one written by someone who knows how the feature is *supposed*
> to
> >> work, because you’re more likely to remember where all the traps are.
> >>
> >> I might write it myself, because I, too, have not yet used this feature
> of
> >> Dancer 2, but it was already on my to-do list.  (I want to use the
> feature
> >> to throttle repeated login attempts without slowing down one-off
> logins.)
> >>
> >> That said, I’ve already written 6 articles for the calendar, and have
> >> received hardly any good feedback, so maybe I should leave the
> remaining 3/4
> >> of the available spots to others.
> >> _______________________________________________
> >> dancer-users mailing list
> >> dancer-users at dancer.pm
> >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
> >
> >
> >
> > _______________________________________________
> > dancer-users mailing list
> > dancer-users at dancer.pm
> > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
> >
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20160109/0b0674de/attachment.html>


More information about the dancer-users mailing list