Skip to content

Commit

Permalink
Merge pull request #706 from pirog/705-updateWaketoGuzz6
Browse files Browse the repository at this point in the history
#705: Update wake() to use new guzzle6 lingo
  • Loading branch information
TeslaDethray committed Nov 23, 2015
2 parents ed5a22a + 6221ff8 commit ee97790
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions php/Terminus/Models/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Terminus\Models;

use GuzzleHttp\TransferStats as TransferStats;
use Terminus\Request;
use Terminus\Exceptions\TerminusException;
use Terminus\Models\TerminusModel;
Expand Down Expand Up @@ -822,16 +823,21 @@ public function unlock() {
* @return [array] $return_data
*/
public function wake() {
$on_stats = function (TransferStats $stats) {
$this->transfertime = $stats->getTransferTime();
};
$hostnames = $this->getHostnames();
$target = key($hostnames);
$response = Request::send("http://$target/pantheon_healthcheck", 'GET');
$healthc = "http://$target/pantheon_healthcheck";
$response = Request::send($healthc, 'GET', array('on_stats' => $on_stats));
$return_data = array(
'success' => $response->isSuccessful(),
'time' => $response->getInfo('total_time'),
'success' => $response->getStatusCode() === 200,
'time' => $this->transfertime,
'styx' => $response->getHeader('X-Pantheon-Styx-Hostname'),
'response' => $response,
'target' => $target,
);

return $return_data;
}

Expand Down
2 changes: 1 addition & 1 deletion php/Terminus/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private function send($uri, $method, array $arg_params = array()) {
'headers' => array(
'User-Agent' => $this->userAgent(),
'Content-type' => 'application/json',
),
)
);

if ($session = Session::instance()->get('session', false)) {
Expand Down

0 comments on commit ee97790

Please sign in to comment.