[Mojolicious] Re: writing chunks in non-blocking mode

2016-10-21 Thread Heiko Jansen
Am Freitag, 14. Oktober 2016 01:06:57 UTC+2 schrieb Steve Barnsley:
>
> I tried 'wrapping' the list of calls to the various templates in a 
> $c->delay(@list); structure, this causes the first template (table) to 
> execute in its entirety but it never starts the second entry in the list 
> (even though I see the result from the very last statement in the sub in 
> $list[0].) Is there some magic that I need to invoke to make delay start 
> the next item in the list? 
>

Without any deeper knowledge of your code that´s a tough question.
@list is a list of subroutine references, right?
You do call $delay->begin in every callback in that list, don´t you?
Otherwise, like https://metacpan.org/pod/Mojo::IOLoop::Delay#steps says: 
"This chain will continue until ... a callback does not increment the event 
counter ..."

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: writing chunks in non-blocking mode

2016-10-13 Thread Steve Barnsley
Thanks for the suggestion Heiko.  I've done something similar to what you 
propose in a prior project - send the entire table to the browser at the 
start with the 'status' column blank then open a websocket that sends the 
status value for each row to the browser and have a little javacript that 
plugs in the status value in the appropriate row.  I was hoping to avoid 
that with this project because it seems like overkill for such a simple 
project, but the eventsource method in the link that you sent looks much 
simpler to implement so I'll experiment with that.

I tried 'wrapping' the list of calls to the various templates in a 
$c->delay(@list); structure, this causes the first template (table) to 
execute in its entirety but it never starts the second entry in the list 
(even though I see the result from the very last statement in the sub in 
$list[0].) Is there some magic that I need to invoke to make delay start 
the next item in the list?

On Thursday, October 13, 2016 at 5:38:56 PM UTC-4, Heiko Jansen wrote:
>
> I´m not sure if I understand your workflow correctly but how about this: 
> for every row processed send a small JSON documents to the browser which 
> contains information on the worksheet, row and row status and then have 
> some JavaScript code in the browser assemble and update the correct HTML 
> table (inserting another row)?
> I´d probably render a skeleton HTML page as response to the upload of the 
> Excel file, then start a new AJAX request from that page which triggers the 
> processing of the spreadsheet uploaded previously and receives the 
> processing status as "server-sent events" (cf. 
> http://www.w3.org/TR/eventsource/ 
> 
> ).
>
> Heiko
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: writing chunks in non-blocking mode

2016-10-13 Thread Heiko Jansen
I´m not sure if I understand your workflow correctly but how about this: 
for every row processed send a small JSON documents to the browser which 
contains information on the worksheet, row and row status and then have 
some JavaScript code in the browser assemble and update the correct HTML 
table (inserting another row)?
I´d probably render a skeleton HTML page as response to the upload of the 
Excel file, then start a new AJAX request from that page which triggers the 
processing of the spreadsheet uploaded previously and receives the 
processing status as "server-sent events" (cf. 
http://www.w3.org/TR/eventsource/).

Heiko

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.