mirror of
https://github.com/danog/postgres.git
synced 2024-11-30 04:29:12 +01:00
when() → onResolve()
This commit is contained in:
parent
04a6463888
commit
e8e3ea7f7b
@ -39,7 +39,7 @@ class Listener extends StreamListener implements Operation {
|
||||
public function unlisten(): Promise {
|
||||
/** @var \Amp\Promise $promise */
|
||||
$promise = ($this->unlisten)($this->channel);
|
||||
$promise->when(function () {
|
||||
$promise->onResolve(function () {
|
||||
$this->complete();
|
||||
});
|
||||
return $promise;
|
||||
|
@ -53,7 +53,7 @@ class PgSqlConnection extends AbstractConnection {
|
||||
$promise = Promise\timeout($promise, $timeout);
|
||||
}
|
||||
|
||||
$promise->when(function ($exception) use ($connection, $poll, $await) {
|
||||
$promise->onResolve(function ($exception) use ($connection, $poll, $await) {
|
||||
if ($exception) {
|
||||
\pg_close($connection);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ class PgSqlExecutor implements Executor {
|
||||
}
|
||||
|
||||
$promise = $this->query(\sprintf("UNLISTEN %s", $channel));
|
||||
$promise->when(function () use ($emitter) {
|
||||
$promise->onResolve(function () use ($emitter) {
|
||||
$emitter->resolve();
|
||||
});
|
||||
return $promise;
|
||||
|
@ -52,7 +52,7 @@ class PqConnection extends AbstractConnection {
|
||||
$promise = Promise\timeout($promise, $timeout);
|
||||
}
|
||||
|
||||
$promise->when(function () use ($poll, $await) {
|
||||
$promise->onResolve(function () use ($poll, $await) {
|
||||
Loop::cancel($poll);
|
||||
Loop::cancel($await);
|
||||
});
|
||||
|
@ -274,7 +274,7 @@ class PqExecutor implements Executor {
|
||||
}
|
||||
|
||||
$promise = new Coroutine($this->send([$this->handle, "unlistenAsync"], $channel));
|
||||
$promise->when(function () use ($emitter) {
|
||||
$promise->onResolve(function () use ($emitter) {
|
||||
$emitter->resolve();
|
||||
});
|
||||
return $promise;
|
||||
|
Loading…
Reference in New Issue
Block a user