1
1
Fork 0

allow for multiple pubsub hubs so everything can still work when/if one goes flaky

(Google's hub has been particularly unreliable recently and the symptoms are that
you just stop receiving updates, and/or updates you send are silently dropped and
never delivered). Also add more instrumentation to help debug pubsub issues.
This commit is contained in:
Mike Macgirvin 2010-10-15 04:20:42 -07:00
commit 35a9b49ed0
4 changed files with 67 additions and 19 deletions

View file

@ -39,7 +39,10 @@ function pubsub_init(&$a) {
$hub_lease = notags(trim($_GET['hub_lease_seconds']));
$hub_verify = notags(trim($_GET['hub_verify_token']));
$debugging = get_config('system','debugging');
if($debugging) {
file_put_contents('pubsub.out', 'Pubsubhubbub subscription called from ' . $_SERVER['REMOTE_ADDR'] . ' at ' . datetime_convert() . "\n" . print_r($_GET,true), FILE_APPEND);
}
$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
@ -86,8 +89,9 @@ function pubsub_post(&$a) {
$xml = file_get_contents('php://input');
$debugging = get_config('system','debugging');
$remote_host = 'Pubsub feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' at ' . datetime_convert() . "\n\n";
if($debugging)
file_put_contents('pubsub.out',$xml,FILE_APPEND);
file_put_contents('pubsub.out', $remote_host . $xml, FILE_APPEND);
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);