Skip to content

Commit

Permalink
fix campaign stop and resume issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tahiralmas committed Jun 3, 2013
1 parent 2d07593 commit 88f3bf4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions broadcast/broadcast.module
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,13 @@ function broadcast_campaign_service_stop($campaign_id) {
if ($PID = $result->fetchField()) {
// TODO: before killing verify that campaign is running and PID is valid
shell_exec('kill -9 '.$PID.' > /dev/null &');

// To fix campaign stop and resume issue
$camp['campaign_id'] = $campaign_id;
$camp['status'] = CAMPAIGN_RUNNING;
drupal_write_record('broadcast_campaign', $camp, 'campaign_id');
// stop resume issue

// TODO: check to confirm that campaign has stopped
return TRUE;
}
Expand Down
7 changes: 7 additions & 0 deletions broadcast/broadcast_service
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ for ($try_no = $repeat_start; $try_no <= $camp['repeat_total']; $try_no++) {
drupal_write_record('broadcast_campaign_log', $deliver_result, 'campaign_log_id');

// Update Campaign to reflect current number of contacts done
// new code start: To fix start and resume issue
if ($camp['contact_index'] < $contact_record['contact_id']) {
$camp['contact_index'] = $contact_record['contact_id'];
} else {
unset($camp['contact_index']);
}
// new code end
drupal_write_record('broadcast_campaign', $camp, 'campaign_id');

// do billing stuff
Expand Down

0 comments on commit 88f3bf4

Please sign in to comment.