Endless loop nesting on ensureHub failure now fixed

Essentially I was missing a negation on a test if we were in rediscovery mode.
This commit is contained in:
Mikael Nordfeldth 2017-06-22 14:37:32 +02:00
parent c9a9a8bc58
commit 3395f6081c
2 changed files with 9 additions and 3 deletions

View File

@ -216,6 +216,7 @@ class FeedSub extends Managed_DataObject
*/
public function ensureHub($rediscovered=false)
{
common_debug('Now inside ensureHub again, $rediscovered=='._ve($rediscovered));
if ($this->sub_state !== 'inactive') {
common_log(LOG_INFO, sprintf(__METHOD__ . ': Running hub discovery a possibly active feed in %s state for URI %s', _ve($this->sub_state), _ve($this->uri)));
}
@ -244,7 +245,7 @@ class FeedSub extends Managed_DataObject
common_debug('Database update failed for FeedSub id=='._ve($this->id).' with new huburi: '._ve($this->huburi));
throw new ServerException('Database update failed for FeedSub.');
}
if ($rediscovered) {
if (!$rediscovered) {
$this->renew();
}
return $result;
@ -447,7 +448,8 @@ class FeedSub extends Managed_DataObject
// we avoid running this part over and over and over and over):
common_debug('Running ensureHub again due to 422 status, $rediscovered=='._ve($rediscovered));
$this->ensureHub(true);
$discoveryResult = $this->ensureHub(true);
common_debug('ensureHub is now done and its result was: '._ve($discoveryResult));
} else {
common_log(LOG_ERR, __METHOD__ . ": sub req failed with HTTP $status: " . $response->getBody());
}

View File

@ -45,7 +45,11 @@ class PushInQueueHandler extends QueueHandler
} catch(NoResultException $e) {
common_log(LOG_INFO, "Discarding POST to unknown feed subscription id {$feedsub_id}");
} catch(Exception $e) {
common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing for {$feedsub->getUri()}: " . $e->getMessage());
if (is_null($feedsub)) {
common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing where FeedSub->receive returned null!" . _ve($e->getMessage()));
} else {
common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing for {$feedsub->getUri()}: " . _ve($e->getMessage()));
}
}
return true;
}