fix: [speculative] fix for the event publishing timing issues

pull/8530/head
iglocska 2022-08-05 14:44:37 +02:00
parent 2516c25eae
commit a3f0347a45
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 13 additions and 4 deletions

View File

@ -4300,6 +4300,19 @@ class Event extends AppModel
public function publishRouter($id, $passAlong = null, $user)
{
$event = $this->find('first', array(
'recursive' => -1,
'conditions' => array('Event.id' => $id)
));
if (empty($event)) {
return false;
}
$fieldList = array('published', 'id', 'info', 'publish_timestamp');
$event['Event']['published'] = 1;
$event['Event']['publish_timestamp'] = time();
$this->save($event, array('fieldList' => $fieldList));
if (Configure::read('MISP.background_jobs')) {
/** @var Job $job */
@ -4380,10 +4393,6 @@ class Event extends AppModel
'order' => ['id ASC']
]);
}
$fieldList = array('published', 'id', 'info', 'publish_timestamp');
$event['Event']['skip_zmq'] = 1;
$event['Event']['skip_kafka'] = 1;
$this->save($event, array('fieldList' => $fieldList));
$userForPubSub = [
'id' => 0,
'org_id' => $hostOrg['Org']['id'],