浏览代码

Update Swoole version + Fixed Push/Pop (#4265)

* Updated Swoole version from 2.1.3 to 4.2.9

* Changed push/pop to enqueue/dequeue

See issue #2214 from Swoole reporting:

https://github.com/swoole/swoole-src/pull/2214/
Indribell 6 年之前
父节点
当前提交
299abdab97
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 3 3
      frameworks/PHP/swoole/swoole-server.php
  2. 1 1
      frameworks/PHP/swoole/swoole.dockerfile

+ 3 - 3
frameworks/PHP/swoole/swoole-server.php

@@ -232,7 +232,7 @@ class DatabasePool
 
     function put($db)
     {
-        $this->pool->push($db);
+        $this->pool->enqueue($db);
         $this->pool_count++;
     }
 
@@ -240,9 +240,9 @@ class DatabasePool
     {
         if ($this->pool_count > 0) {
             $this->pool_count--;
-            return $this->pool->pop();
+            return $this->pool->dequeue();
         }
-
+        
         // No idle connection, time to create a new connection
         if ($server_type === 'mysql') {
             $db = new Swoole\Coroutine\Mysql;

+ 1 - 1
frameworks/PHP/swoole/swoole.dockerfile

@@ -1,6 +1,6 @@
 FROM php:7.2
 
-ENV SWOOLE_VERSION=2.1.3
+ENV SWOOLE_VERSION=4.2.9
 
 RUN cd /tmp && curl -sSL "https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz" | tar xzf - \
         && cd swoole-src-${SWOOLE_VERSION} \