Skip to content

Commit

Permalink
[backend] do not mis-use a deep-check event to resume a project
Browse files Browse the repository at this point in the history
This is way too expensive for our update channels.
  • Loading branch information
mlschroe committed Nov 23, 2017
1 parent 4b31738 commit 5569663
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
24 changes: 24 additions & 0 deletions src/backend/BSSched/EventHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ our %event_handlers = (
'useforbuild' => \&BSSched::EventHandler::event_useforbuild,
'configuration' => \&BSSched::EventHandler::event_configuration,
'suspendproject' => \&BSSched::EventHandler::event_suspendproject,
'resumeproject' => \&BSSched::EventHandler::event_resumeproject,
'memstats' => \&BSSched::EventHandler::event_memstats,
'dispatchdetails' => \&BSSched::EventHandler::event_dispatchdetails,
'force_publish' => \&BSSched::EventHandler::event_force_publish,
Expand Down Expand Up @@ -545,6 +546,29 @@ sub event_suspendproject {
}
}

sub event_resumeproject {
my ($ectx, $ev) = @_;
my $projid = $ev->{'project'};
my $gctx = $ectx->{'gctx'};
my $job = $gctx->{'projsuspended'}->{$projid};
my $evjob = $ev->{'job'} || '';
if (!$job) {
print "ignoring resumeproject for project $projid ($evjob)\n";
return;
}
print "resuming project $projid: $job ($evjob)\n";
delete $gctx->{'projsuspended'}->{$projid};
my $changed_high = $gctx->{'changed_high'};
my $changed_dirty = $gctx->{'changed_dirty'};
$changed_high->{$projid} ||= 1;
for my $prp (@{$gctx->{'prps'}}) {
if ((split('/', $prp, 2))[0] eq $projid) {
$changed_high->{$prp} ||= 1;
$changed_dirty->{$prp} = 1;
}
}
}

=head2 event_uploadbuildimport_delay - check if an upload event needs to be delayed
TODO: add description
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bs_repserver
Original file line number Diff line number Diff line change
Expand Up @@ -2277,7 +2277,7 @@ sub forwardevent {
$worker = $cgi->{'worker'} if exists $cgi->{'worker'};
$job = $cgi->{'job'} if exists $cgi->{'job'};
}
$job = $cgi->{'job'} if exists($cgi->{'job'}) && $type eq 'suspendproject';
$job = $cgi->{'job'} if exists($cgi->{'job'}) && $type eq 'suspendproject' || $type eq 'resumeproject';
# hack: mis-use job to transfer wipe target
if ($type eq 'wipe' && $cgi->{'wipe'}) {
$job = join(',', @{$cgi->{'wipe'}});
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -3849,7 +3849,7 @@ sub docommand {
return $BSStdServer::return_ok;
}
if ($cgi->{'cmd'} eq 'resumeproject') {
notify_repservers('package', $projid); # also resumes the project
notify_repservers('resumeproject', $projid, undef, $cgi->{'comment'} || 'suspendproject');
return $BSStdServer::return_ok;
}
my @prpas;
Expand Down

0 comments on commit 5569663

Please sign in to comment.