Fixes #3907, enrich event job not marked as completed.

The enrichment background process did not do anything to update the job
after completing its task.  I used the same logic as the adjcacent
'publish' function to record progress, update the message and create a
log entry.
pull/3954/head
Kevin 2018-12-17 13:55:59 -05:00
parent ac063792f9
commit 9446c93ad4
1 changed files with 12 additions and 0 deletions

View File

@ -558,12 +558,24 @@ class EventShell extends AppShell
$this->Job->save($data);
$jobId = $this->Job->id;
}
$job = $this->Job->read(null, $jobId)
$options = array(
'user' => $user,
'event_id' => $eventId,
'modules' => $modules
);
$result = $this->Event->enrichment($options);
$job['Job']['progress'] = 100;
$job['Job']['date_modified'] = date("y-m-d H:i:s");
if ($result) {
$job['Job']['message'] = 'Added ' . $result . ' attribute' . ($result > 1 ? 's.' : '.')
} else {
$job['Job']['message'] = 'Enrichment finished, but no attributes added.';
}
$this->Job->save($job);
$log = ClassRegistry::init('Log');
$log->create();
$log->createLogEntry($user, 'enrichment', 'Event', $eventId, 'Event (' . $eventId . '): enriched.', 'enriched () => (1)');
}
public function processfreetext() {