Skip to content

Commit fb69f41

Browse files
authored
Merge pull request #30 from chadicus/dev/string-handles
use strings as handles in GuzzleAdapter
2 parents 2dacf7b + 810e6ed commit fb69f41

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

.travis.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@ language: php
22
php:
33
- 7.0
44
- 5.6
5-
env:
6-
- EXT_VERSION=1.1 DB_PACKAGE=mongodb-10gen
7-
- EXT_VERSION=1.1 DB_PACKAGE=mongodb-org
8-
services:
5+
services:
96
- redis-server
10-
before_install:
11-
- "sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10"
12-
- "echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list"
13-
- "sudo apt-get update"
14-
- "sudo apt-get install ${DB_PACKAGE}"
7+
- mongodb
158
before_script:
169
- composer self-update || true
17-
- yes '' | pecl install -f mongodb-${EXT_VERSION}
18-
# wait for mongo, start is only needed for 2.4 package, see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
19-
- sudo service mongodb start; bash -c 'while ! exec 6<>/dev/tcp/localhost/27017; do echo "$(date) - still trying to connect to mongo"; sleep 1; done'
10+
- yes '' | pecl install -f mongodb-1.1
11+
- bash -c 'while ! exec 6<>/dev/tcp/localhost/27017; do echo "$(date) - still trying to connect to mongo"; sleep 1; done'
2012
script: ./build.php
2113
after_script: ./vendor/bin/coveralls -v

src/GuzzleAdapter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function __construct()
5555
*/
5656
public function start(Request $request)
5757
{
58-
$this->_promises[] = $this->_client->requestAsync(
58+
$handle = uniqid();
59+
$this->_promises[$handle] = $this->_client->requestAsync(
5960
$request->getMethod(),
6061
$request->getUrl(),
6162
[
@@ -64,8 +65,7 @@ public function start(Request $request)
6465
]
6566
);
6667

67-
end($this->_promises);
68-
return key($this->_promises);
68+
return $handle;
6969
}
7070

7171
/**
@@ -75,8 +75,6 @@ public function start(Request $request)
7575
*/
7676
public function end($endHandle)
7777
{
78-
Util::throwIfNotType(['int' => [$endHandle]]);
79-
8078
$results = $this->fulfillPromises($this->_promises, $this->_exceptions);
8179
foreach ($results as $handle => $response) {
8280
try {

0 commit comments

Comments
 (0)