mirror of
git://scm.dxcluster.org/scm/spider
synced 2024-09-21 15:57:12 +00:00
backport DXSubprocess to change serialisations
Currently the internals of Mojo::IOLoop::Subprocess defaults to using Storaable as its cross-process argument and data serialisaion method. It can use others. This update reverts back to the original ForkCall method of using JSON.
This commit is contained in:
parent
3b932bf2af
commit
9d190c7619
6
Changes
6
Changes
@ -1,3 +1,9 @@
|
||||
17May20=======================================================================
|
||||
1. Backport DXSubprocess to change serialisations.
|
||||
Currently the internals of Mojo::IOLoop::Subprocess defaults to
|
||||
using Storeable as its cross-process argument and data serialisaion
|
||||
method. It can use others. This update reverts back to the
|
||||
original ForkCall method of using JSON.
|
||||
10May20=======================================================================
|
||||
1. Added basic changes so that users *could* have multiple connections to the
|
||||
same node if it is allowed. This is work in progress and is there to see
|
||||
|
@ -43,7 +43,7 @@ use JSON;
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
|
||||
use Mojo::IOLoop;
|
||||
use Mojo::IOLoop::Subprocess;
|
||||
use DXSubprocess;
|
||||
use Mojo::UserAgent;
|
||||
|
||||
use strict;
|
||||
@ -1316,7 +1316,7 @@ sub spawn_cmd
|
||||
return @out;
|
||||
}
|
||||
|
||||
my $fc = Mojo::IOLoop::Subprocess->new;
|
||||
my $fc = DXSubprocess->new;
|
||||
# $fc->serializer(\&encode_json);
|
||||
# $fc->deserializer(\&decode_json);
|
||||
$fc->run(
|
||||
|
@ -15,7 +15,7 @@ use DXDebug;
|
||||
use IO::File;
|
||||
use DXLog;
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
use Mojo::IOLoop::Subprocess;
|
||||
use DXSubprocess;
|
||||
|
||||
use strict;
|
||||
|
||||
@ -257,7 +257,7 @@ sub spawn
|
||||
my $t0 = [gettimeofday];
|
||||
|
||||
dbg("DXCron::spawn: $line") if isdbg("cron");
|
||||
my $fc = Mojo::IOLoop::Subprocess->new();
|
||||
my $fc = DXSubprocess->new();
|
||||
$fc->run(
|
||||
sub {
|
||||
my @res = `$line`;
|
||||
@ -286,7 +286,7 @@ sub spawn_cmd
|
||||
my $t0 = [gettimeofday];
|
||||
|
||||
dbg("DXCron::spawn_cmd run: $line") if isdbg('cron');
|
||||
my $fc = Mojo::IOLoop::Subprocess->new();
|
||||
my $fc = DXSubprocess->new();
|
||||
$fc->run(
|
||||
sub {
|
||||
$main::me->{_nospawn} = 1;
|
||||
|
@ -35,7 +35,7 @@ use Script;
|
||||
use DXProtHandle;
|
||||
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
use Mojo::IOLoop::Subprocess;
|
||||
use DXSubprocess;
|
||||
|
||||
use strict;
|
||||
|
||||
@ -1216,7 +1216,7 @@ sub spawn_cmd
|
||||
|
||||
no strict 'refs';
|
||||
|
||||
my $fc = Mojo::IOLoop::Subprocess->new;
|
||||
my $fc = DXSubprocess->new;
|
||||
|
||||
# just behave normally if something has set the "one-shot" _nospawn in the channel
|
||||
if ($self->{_nospawn}) {
|
||||
|
23
perl/DXSubprocess.pm
Normal file
23
perl/DXSubprocess.pm
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# A light shim over Mojo::IOLoop::Subprocess (or Mojo::IOLoop::ForkCall, if we need to go back to that)
|
||||
#
|
||||
# But we stop using Storable!
|
||||
#
|
||||
|
||||
package DXSubprocess;
|
||||
|
||||
use DXUtil;
|
||||
use DXDebug;
|
||||
use Mojo::IOLoop;
|
||||
use Mojo::IOLoop::Subprocess;
|
||||
use JSON;
|
||||
|
||||
our @ISA = qw(Mojo::IOLoop::Subprocess);
|
||||
|
||||
sub new
|
||||
{
|
||||
my $pkg = shift;
|
||||
my $class = ref $pkg || __PACKAGE__;
|
||||
my $ref = Mojo::IOLoop::Subprocess->new->serialize(\&encode_json)->deserialize(\&decode_json);
|
||||
return bless $ref, $class;
|
||||
}
|
Loading…
Reference in New Issue
Block a user