Skip to content
Snippets Groups Projects
Commit 3516859b authored by elliotttf's avatar elliotttf Committed by Dave Reid
Browse files

Issue #1418382: Fixed unsubscribe requests to PuSH hubs failing due to...

Issue #1418382: Fixed unsubscribe requests to PuSH hubs failing due to transaction in node_delete().
parent cd8513e3
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,9 @@ function feeds_cron_job_scheduler_info() {
$info['feeds_importer_expire'] = array(
'queue name' => 'feeds_importer_expire',
);
$info['feeds_push_unsubscribe'] = array(
'queue name' => 'feeds_push_unsubscribe',
);
return $info;
}
......@@ -93,6 +96,10 @@ function feeds_cron_queue_info() {
'worker callback' => 'feeds_importer_expire',
'time' => 15,
);
$queues['feeds_push_unsubscribe'] = array(
'worker callback' => 'feeds_push_unsubscribe',
'time' => 15,
);
return $queues;
}
......@@ -147,6 +154,15 @@ function feeds_importer_expire($job) {
$importer->scheduleExpire();
}
/**
* Scheduler callback for unsubscribing from PuSH hubs.
*/
function feeds_push_unsubscribe($job) {
$source = feeds_source($job['type'], $job['id']);
$fetcher = feeds_plugin('FeedsHTTPFetcher', $source->importer->id);
$fetcher->unsubscribe($source);
}
/**
* Batch API worker callback. Used by FeedsSource::startBatchAPIJob().
*
......
......@@ -181,7 +181,20 @@ class FeedsHTTPFetcher extends FeedsFetcher {
*/
public function sourceDelete(FeedsSource $source) {
if ($this->config['use_pubsubhubbub']) {
$this->unsubscribe($source);
// If we're in a feed node, queue the unsubscribe,
// else process immediately.
if ($source->feed_nid) {
$job = array(
'type' => $source->id,
'id' => $source->feed_nid,
'period' => 0,
'periodic' => FALSE,
);
JobScheduler::get('feeds_push_unsubscribe')->set($job);
}
else {
$this->unsubscribe($source);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment