Use getByID nistead of getKV for Feedsub in PushInQueueHandler

This commit is contained in:
Mikael Nordfeldth 2017-04-25 20:42:10 +02:00
parent 956cfaf844
commit a53284fe4f

View File

@ -17,9 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('STATUSNET')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
/** /**
* Process a feed distribution POST from a PuSH hub. * Process a feed distribution POST from a PuSH hub.
@ -41,15 +39,13 @@ class PushInQueueHandler extends QueueHandler
$post = $data['post']; $post = $data['post'];
$hmac = $data['hmac']; $hmac = $data['hmac'];
$feedsub = FeedSub::getKV('id', $feedsub_id);
if ($feedsub instanceof FeedSub) {
try { try {
$feedsub = FeedSub::getByID($feedsub_id);
$feedsub->receive($post, $hmac); $feedsub->receive($post, $hmac);
} catch(NoResultException $e) {
common_log(LOG_INFO, "Discarding POST to unknown feed subscription id {$feedsub_id}");
} catch(Exception $e) { } catch(Exception $e) {
common_log(LOG_ERR, "Exception during PuSH input processing for $feedsub->uri: " . $e->getMessage()); common_log(LOG_ERR, "Exception during PuSH input processing for {$feedsub->getUri()}: " . $e->getMessage());
}
} else {
common_log(LOG_ERR, "Discarding POST to unknown feed subscription id $feedsub_id");
} }
return true; return true;
} }