Skip to content

Commit 358813c

Browse files
committed
Context::onDestroy
1 parent 3345cc2 commit 358813c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Manager.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use think\helper\Str;
1818
use Throwable;
1919
use Webman\Context;
20-
use Workerman\Coroutine\Coroutine;
2120
use Workerman\Coroutine\Pool;
2221

2322
abstract class Manager
@@ -164,7 +163,7 @@ protected function createDriver(string $name): mixed
164163
$connection = static::$pools[$name]->get();
165164
Context::set($key, $connection);
166165
} finally {
167-
Coroutine::defer(function () use ($connection, $name) {
166+
Context::onDestroy(function () use ($connection, $name) {
168167
try {
169168
$connection && static::$pools[$name]->put($connection);
170169
} catch (Throwable) {

0 commit comments

Comments
 (0)