Comments (5)
我晚上看看
from swoole-src.
在同步模式下,或者guzzle设置stream=false时,超时配置都正常生效。
from swoole-src.
尝试在Swoole\Server::set
设置default_socket_timeout = 5
试试看
from swoole-src.
尝试在
Swoole\Server::set
设置default_socket_timeout = 5
试试看
这个应该是ini_set的选项吧,设置后有点奇怪,超时时间为12秒,刚好等于socket_timeout + timeout.
<?php
use GuzzleHttp\Client;
require 'vendor/autoload.php';
Co::set([
'socket_connect_timeout' => 2,
'socket_timeout' => 4
]);
ini_set('default_socket_timeout', 1);
$http = new Swoole\Http\Server('127.0.0.1', 9501);
$http->set(['hook_flags' => SWOOLE_HOOK_ALL]);
$http->on('request', function ($request, $response) {
$result = [];
$client = new Client([
'timeout' => 8,
'connect_timeout' => 3,
// 'read_timeout' => 3,
'stream' => true
]);
print_r(date("Y-m-d H:i:s")." 准备发起请求\n");
$client->post("https://i.cmd.center:38000");
print_r(date("Y-m-d H:i:s")." 发起请求之后\n");
$response->end(json_encode($result));
});
echo "http start";
$http->start();
from swoole-src.
这个最好看一下防火墙规则,我这边没复现出来
from swoole-src.
Related Issues (20)
- Calling macro `swoole_fatal_error` will immediately terminate the process without executing `php_request_shutdown` in Swoole 5.1.x HOT 3
- php-swoole 6.0.0 is leading to issues with PDO connections to postgres HOT 11
- Cancel Coroutine ! HOT 1
- WARNING Server::check_worker_exit_status(): worker(pid=8162, id=13) abnormal exit, status=0, signal=11 HOT 2
- Manage connections at 1 second intervals from within the websocket task, close connections etc. HOT 2
- PHP Fatal error: Cannot redeclare Swoole\Coroutine\run() (previously declared in @swoole/library/core/Coroutine/functions.php:16) in [my_project_folder]/vendor/swoole/library/src/core/Coroutine/functions.php on line 24 HOT 2
- https://swoole.com/download 页面的文件均无法下载 HOT 1
- problem with variable value HOT 4
- 6.0开启线程,打开文件过多 HOT 5
- v6.0线程的Swoole\Thread\Map的bug HOT 6
- 开启 HTTP2 时,$request->server['request_method'] 与 $request->getMethod() 的结果不一致。 HOT 3
- swoole5.1.3 运行时异常退出 HOT 4
- Critically Urgent: Cloud Deployment Architecture for Swoole in Multi-process / Multi-threaded Mode
- swoole v6.0.0-dev 版本的swoole-cli 异常 HOT 2
- V6.0 配置了bootstrap后 没有执行$server->on和$server->start 事件就会失效 HOT 1
- Server deadlock when using max_concurrency HOT 3
- Swoole Tracker3.1发布,支持完善的内存泄漏检测!请问现在找不到Swoole Tracker 下载链接,是不提供该扩展了么? HOT 1
- v6.0 lock 多线程锁性能提升的一个方案 HOT 1
- php8.3 swoole5.1.3 kernel: php[1048884]: segfault at 48 ip 00007f82db25f197 sp 00007ffc466aa9c0 error 4 in swoole.so[7f82db1df000+1a2000] HOT 14
- undefined method Swoole\Thread::exec() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swoole-src.