Skip to content

Commit 3345cc2

Browse files
committed
Workerman Coroutine
1 parent 5a8c333 commit 3345cc2

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"license": "MIT",
55
"require": {
6-
"workerman/webman-framework": "^2.0 || dev-master",
6+
"workerman/webman-framework": "^2.1 || dev-master",
77
"topthink/think-container": "^2.0",
88
"psr/simple-cache": "^1.0|^2.0|^3.0"
99
},

src/Manager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
use think\helper\Str;
1818
use Throwable;
1919
use Webman\Context;
20-
use Webman\Coroutine\Pool;
20+
use Workerman\Coroutine\Coroutine;
21+
use Workerman\Coroutine\Pool;
2122

2223
abstract class Manager
2324
{
@@ -163,7 +164,7 @@ protected function createDriver(string $name): mixed
163164
$connection = static::$pools[$name]->get();
164165
Context::set($key, $connection);
165166
} finally {
166-
Context::onDestroy(function () use ($connection, $name) {
167+
Coroutine::defer(function () use ($connection, $name) {
167168
try {
168169
$connection && static::$pools[$name]->put($connection);
169170
} catch (Throwable) {

src/driver/Redis.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use DateInterval;
1717
use DateTimeInterface;
1818
use RedisException;
19-
use Webman\Coroutine\Pool;
19+
use Workerman\Coroutine\Pool;
2020
use Webman\ThinkCache\Driver;
2121

2222
class Redis extends Driver

0 commit comments

Comments
 (0)