From ba92804ea5a9c67f586776ae96f6d18af04ff94b Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sun, 28 Jan 2018 22:24:44 -0500 Subject: [PATCH] Make the github event intake endpoint retry connections to rabbitmq until it works --- README.md | 24 +++++++++++++----------- php/web/index.php | 24 +++++++++++++++++++++++- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 24a9148..b7bf170 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,9 @@ config.known-users.json, run `./scripts/update-known-users.sh`. ## old php stuff... +Only Graham needs to do this, since I run the only remaining PHP +components. + ```php true, 'verify_peer_name' => true, - 'peer_name' => 'events.nix.gsc.io', + 'peer_name' => $host, 'verify_depth' => 10, - 'ca_file' => '/etc/ssl/certs/ca-certificates.crt' + 'ca_file' => '/etc/ssl/certs/ca-certificates.crt', + ), array( + 'connection_timeout' => $timeout, ) ); return $connection; } -/* -# Only leader machines (ie: graham's) need this: function gh_client() { $client = new \Github\Client(); $client->authenticate('githubusername', @@ -193,5 +195,5 @@ function gh_client() { return $client; } -*/ + ``` diff --git a/php/web/index.php b/php/web/index.php index e930f20..a26b5e7 100644 --- a/php/web/index.php +++ b/php/web/index.php @@ -1,5 +1,8 @@ repository->full_name); $eventtype = event_type(); - $connection = rabbitmq_conn(); + $connection = retry_rabbitmq_conn(); $channel = $connection->channel(); $dec = $channel->exchange_declare('github-events', 'topic', false, true, false);