I guess it depends how much time does the slurping takes. If you think this
request is blocking for too long, then you could read the files inside a
fork using Mojo::IOLoop::ForkCall for instance.
Le vendredi 1 avril 2016 20:09:55 UTC+2, Charlie Brady a écrit :
>
>
> I'm starting on the task of converting a preforking server into a
> non-blocking server for a small webservice. One of my handlers generates a
> data structure by reading the content of a subtree of files.
>
> In essense, it does something like this:
>
> ...
> my $data = {
> map { $_ => Mojo::Util::slurp("/path/to/files/$_" }
> (qw(one two three four));
> };
> $c->render(json => $data);
> };
>
> Can someone give me some hints as to how to do that as a series of
> non-blocking callbacks, or do we just shrug and say "it's not going to
> block for too long".
>
> Thanks
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.