Fixing redis bug.
This commit is contained in:
parent
305c5316b3
commit
15c9d2f6fd
@ -49,7 +49,6 @@ sub handle ( $self, $ws, $session, $data ) {
|
|||||||
my @friends = grep { $pj->uuid ne $_->uuid } @team_members;
|
my @friends = grep { $pj->uuid ne $_->uuid } @team_members;
|
||||||
my $team_pjs = [ map { $_->hash } ( $pj, @friends ) ];
|
my $team_pjs = [ map { $_->hash } ( $pj, @friends ) ];
|
||||||
my $location = $team->location;
|
my $location = $team->location;
|
||||||
my $connected_places = $self->_get_connected_places($pj);
|
|
||||||
|
|
||||||
$pj->append_log_line(
|
$pj->append_log_line(
|
||||||
[
|
[
|
||||||
@ -77,6 +76,7 @@ sub handle ( $self, $ws, $session, $data ) {
|
|||||||
my $info_packet_to_send =
|
my $info_packet_to_send =
|
||||||
LasTres::Controller::Websocket::OutputPacket::Info->new(
|
LasTres::Controller::Websocket::OutputPacket::Info->new(
|
||||||
set_log => [ $pj->last_50_log ],
|
set_log => [ $pj->last_50_log ],
|
||||||
|
$self->_location_data($pj),
|
||||||
team_pjs => $team_pjs,
|
team_pjs => $team_pjs,
|
||||||
clear => $JSON::true,
|
clear => $JSON::true,
|
||||||
);
|
);
|
||||||
@ -90,8 +90,23 @@ sub handle ( $self, $ws, $session, $data ) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
$session->{redis} = $redis;
|
$session->{redis} = $redis;
|
||||||
$redis->publish( $redis->pj_subscription($pj),
|
}
|
||||||
to_json( { command => 'update-location' } ) );
|
|
||||||
|
sub _location_data($self, $pj) {
|
||||||
|
my $connected_places = $self->_get_connected_places($pj);
|
||||||
|
my $team = $pj->team;
|
||||||
|
my $location = $team->location;
|
||||||
|
return (
|
||||||
|
location_data => {
|
||||||
|
current => $location->hash,
|
||||||
|
(
|
||||||
|
( $team->is_moving )
|
||||||
|
? ( moving_to => LasTres::Location::get(@{from_json( $team->moving_to )})->hash )
|
||||||
|
: ()
|
||||||
|
),
|
||||||
|
connected_places => $connected_places,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _on_redis_event ( $self, $ws, $session, $message, $topic, $topics ) {
|
sub _on_redis_event ( $self, $ws, $session, $message, $topic, $topics ) {
|
||||||
@ -106,20 +121,9 @@ sub _on_redis_event ( $self, $ws, $session, $message, $topic, $topics ) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( $data->{command} eq 'update-location' ) {
|
if ( $data->{command} eq 'update-location' ) {
|
||||||
my $team = $pj->team;
|
|
||||||
my $location = $team->location;
|
|
||||||
my $connected_places = $self->_get_connected_places($pj);
|
|
||||||
my $info_packet_to_send =
|
my $info_packet_to_send =
|
||||||
LasTres::Controller::Websocket::OutputPacket::Info->new(
|
LasTres::Controller::Websocket::OutputPacket::Info->new(
|
||||||
location_data => {
|
$self->_location_data($pj)
|
||||||
current => $location->hash,
|
|
||||||
(
|
|
||||||
( $team->is_moving )
|
|
||||||
? ( moving_to => LasTres::Location::get(@{from_json( $team->moving_to )})->hash )
|
|
||||||
: ()
|
|
||||||
),
|
|
||||||
connected_places => $connected_places,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$info_packet_to_send->send($ws);
|
$info_packet_to_send->send($ws);
|
||||||
|
@ -27,7 +27,7 @@ sub get_auto_discover($self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub frames_to_move {
|
sub frames_to_move {
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub identifier {
|
sub identifier {
|
||||||
|
Loading…
Reference in New Issue
Block a user