projects
/
MojoX-Gearman.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new own Mojo::IOLoop to play nice with Mojolicious
[MojoX-Gearman.git]
/
lib
/
MojoX
/
Gearman.pm
diff --git
a/lib/MojoX/Gearman.pm
b/lib/MojoX/Gearman.pm
index
5821839
..
af521b8
100644
(file)
--- a/
lib/MojoX/Gearman.pm
+++ b/
lib/MojoX/Gearman.pm
@@
-14,7
+14,7
@@
use Data::Dump qw(dump);
require Carp;
__PACKAGE__->attr(server => '127.0.0.1:4730');
require Carp;
__PACKAGE__->attr(server => '127.0.0.1:4730');
-__PACKAGE__->attr(ioloop => sub { Mojo::IOLoop->
singleton
});
+__PACKAGE__->attr(ioloop => sub { Mojo::IOLoop->
new
});
__PACKAGE__->attr(error => undef);
__PACKAGE__->attr(timeout => 300);
__PACKAGE__->attr(encoding => 'UTF-8');
__PACKAGE__->attr(error => undef);
__PACKAGE__->attr(timeout => 300);
__PACKAGE__->attr(encoding => 'UTF-8');
@@
-120,7
+120,6
@@
sub req {
my $response;
my $cb = sub {
my ( $self, $data ) = @_;
my $response;
my $cb = sub {
my ( $self, $data ) = @_;
- $self->stop;
warn "# <<<< ",dump($data);
my ( $type, @data ) = $self->parse_packet($data);
warn "# <<<< ",dump($data);
my ( $type, @data ) = $self->parse_packet($data);
@@
-133,7
+132,8
@@
warn "# WORK_COMPLETE ",dump $data;
$self->res( $out );
$self->stop;
};
$self->res( $out );
$self->stop;
};
- $self->start; # FIXME sync client
+ } else {
+ $self->stop;
}
my $out = $#data == 0 ? $data[0] : [ @data ];
}
my $out = $#data == 0 ? $data[0] : [ @data ];
@@
-155,21
+155,21
@@
warn "# WORK_COMPLETE ",dump $data;
$self->connect unless $self->{_connection};
$self->_send_next_message;
$self->connect unless $self->{_connection};
$self->_send_next_message;
- $self->
ioloop->
start;
+ $self->start;
$self->res;
}
sub start {
my ($self) = @_;
$self->res;
}
sub start {
my ($self) = @_;
-
+ warn "# start";
$self->ioloop->start;
return $self;
}
sub stop {
my ($self) = @_;
$self->ioloop->start;
return $self;
}
sub stop {
my ($self) = @_;
-
+ warn "# stop";
$self->ioloop->stop;
return $self;
}
$self->ioloop->stop;
return $self;
}