Skip to content

Commit

Permalink
[backend] put running projpack xrpcs into fetchprojpacks when writing…
Browse files Browse the repository at this point in the history
… the state

We don't want to lose the events!
  • Loading branch information
mlschroe committed Jan 25, 2016
1 parent 2e96cae commit 3bbd79c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/backend/BSSched/EventHandler.pm
Expand Up @@ -473,6 +473,33 @@ sub event_exit {
$schedstate->{'delayedfetchprojpacks'} = $gctx->{'delayedfetchprojpacks'};
$schedstate->{'watchremote_start'} = $gctx->{'watchremote_start'};
$schedstate->{'fetchprojpacks'} = $ectx->{'fetchprojpacks'} if %{$ectx->{'fetchprojpacks'} || {}};
# collect all running async projpack requests
for my $handle ($gctx->{'rctx'}->xrpc_handles()) {
my $projid = $handle->{'_iswaiting'};
next if $projid =~ /\//;
my %packids;
my $good;
my $meta;
for my $h ($handle, @{$handle->{'_nextxrpc'} || []}) {
my $async = $h;
# HACK: 2 is $param
$async = $h->{'_xrpc_data'}->[2]->{'async'} if $h->{'_xrpc_data'};
next if $async->{'_projid'} ne $projid;
$good = 1;
if ($async->{'_packids'}) {
$packids{$_} = 1 for @{$async->{'_packids'}};
} else {
$packids{$_} = 1 for @{$async->{'_lpackids'} || []};
$meta = 1;
}
}
next unless $good;
my @packids = sort keys %packids;
push @packids, undef if $meta || !@packids;
$schedstate->{'fetchprojpacks'} ||= {};
$schedstate->{'fetchprojpacks'}->{$projid} = [ @{$schedstate->{'fetchprojpacks'}->{$projid} || []}, @packids ];
}

my $rundir = $gctx->{'rundir'};
unlink("$rundir/bs_sched.$myarch.state");
my $statefile = "$rundir/bs_sched.$myarch.state";
Expand Down

0 comments on commit 3bbd79c

Please sign in to comment.