Hi again, just before someone yells at me with the "No-blocking is not
magic", my point is that my test script depends from remote services or
machines that I can´t control.
It is not the case of a long and slow query to a database. If the queries
are the bottleneck and it is a permanent bottleneck, I understand that I
should try a different approach. It also happened to me using object
oriented event driven ActioScript architecture (waiting for infinite events
to come back are also a bottleneck itself).
But if it depends on a remote danger that can paralyze all my app, I think
that the "non-blocking" feature should be really a feature, somehow isn´t
it?
Am I too lost?
Regards:
Nacho B
On Wednesday, January 15, 2014 7:18:23 PM UTC+1, Nacho B wrote:
>
> Hi, I am very, very interested in the non-blocking features of Mojolicious
> and its server, but I am blocked in my first try.
>
> This is a simple remote port test:
>
> use Socket;
>
> my ($ip, $protocol, $port, $myhouse, $yourhouse, $log);
>
> $ip = $site->{ip};
> $port = $site->{port};
> $protocol = getprotobyname('tcp');
>
> socket(SOCKET, PF_INET, SOCK_STREAM, $protocol);
> $yourhouse = inet_aton($ip);
> $myhouse = sockaddr_in($port, $yourhouse);
>
> if (!connect(SOCKET, $myhouse)) {
> $site->{status} = 'KO';
> } else {
> $site->{status} = 'OK';
> close SOCKET || die "close: $!";
> }
>
>
> I am using Morbo for executing it. And I have other pages in the app.
>
> When the remote IP and port are OK, it works fine. But if I use a wrong
> (not responding or fake) IP, it hangs, waiting forever,* and I can't use
> any other pages in the application*. Those pages wait until I cancel this
> process.
>
> I do not want a timeout, but the non-blocking "promise".
>
> Do I need to manage events for such a little function (like I should do in
> ActionScript, for example)? If so, it seems that there is no such thing as
> a non-blocking feature, isn't it?
>
> I think that there is something very, very basic about the non-blocking
> "way of life" that I am missing. Any help very appreciated.
>
> Regards:
> Nacho B
>
>
>
>
--
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.