作者:文人博客 | 来源:互联网 | 2018-05-12 17:05
接口超时502badgateway超时限制失效页面调用接口的时候,响应10s。通过使用xhprof监控,发现是调用接口超时。但是实际上接口超时的时候最多只允许2s,通过stream_set_timeout进行了读流超时限制。查询手册...
接口超时502 bad gate way
超时限制失效
页面调用接口的时候,响应10s。通过使用xhprof监控,发现是调用接口超时。但是实际上接口超时的时候最多只允许2s,通过stream_set_timeout
进行了读流超时限制。
查询手册
手册中有一些例子,其中有一段是这样说的:
If you are using fsockopen() to create a connection, first going to write into the stream and then waiting for the reply (e.g. simulating HTTP request with some extra headers), then stream_set_timeout() must be set only after the write - if it is before write, it has no effect on the read timeout :-(
但是实际上,按照这种写法进行了逻辑修改,依然是无效的。
我改怎么解决这个问题呢?
回复内容:
接口超时502 bad gate way
超时限制失效
页面调用接口的时候,响应10s。通过使用xhprof监控,发现是调用接口超时。但是实际上接口超时的时候最多只允许2s,通过stream_set_timeout
进行了读流超时限制。
查询手册
手册中有一些例子,其中有一段是这样说的:
If you are using fsockopen() to create a connection, first going to write into the stream and then waiting for the reply (e.g. simulating HTTP request with some extra headers), then stream_set_timeout() must be set only after the write - if it is before write, it has no effect on the read timeout :-(
但是实际上,按照这种写法进行了逻辑修改,依然是无效的。
我改怎么解决这个问题呢?