This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
const message = await $.reply($.i18n.t('play.prepare_game')); | |
$.session.game.message_id = message.message_id; | |
let start = async () => { | |
const timestamp = Math.ceil(new Date().getTime() / 1000); // Seconds | |
let kb = []; | |
if (!$.session.game.game_started) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub run { | |
my ($self) = @_; | |
$0 = $self->{procname}; | |
# Создаем процессы слейвов | |
for my $slave_id (sort {$a <=> $b} keys %{$self->{_respawn_ctl}}) { | |
debug "Spawning slave: $slave_id"; | |
my $slave = AsyncJobsServer::Slave->new( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use common::sense; | |
use Data::Dumper; | |
use Socket; | |
use AnyEvent; | |
use AnyEvent::Handle; | |
use AnyEvent::Util qw ( portable_socketpair fh_nonblocking ); | |
my ( $c, $s ) = portable_socketpair(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Master | |
my $slave_handle; | |
$slave_handle = AnyEvent::Handle->new( | |
fh => $slave->{_socket}, | |
on_read => sub { | |
shift->push_read( json => sub { | |
my ( $h, $job_result ) = @_; | |
$jc->job_done( $job_id, $job_result ); | |
}); |