![]() The configuration socket_timeout is the TCP read/ write operation timeout, by default it is 60 seconds. The configuration socket_connect_timeout indicates the TCP connection timeout, by default 2 seconds Values greater than 0 will indicate to set the timeout timer corresponding to the number of seconds. Setting 0 means that the timeout period will not be changed Setting -1 will mean never to timeout, always wait Refer to coroutine documentation for more information. 60,īecause this method is directly changing configuration options for coroutines, this will affect the coroutine clients, so there will then be no need to set timeouts again once this is done, these options last for the lifetime of the running program. In order for a more permanent, global timeout configuration, we can set timeout options using the socket configuration. When you have coroutines enabled on your server, you can set global coroutine configuration options. ![]() Method Three: Global Coroutine Configuration The disadvantage of using global class configuration is that the timeout is only valid for that specific instance, so the timeout has to be set per client, per class. It is recommended to use coroutine hooks and use the native clients built for PHP to use MySQL or Redis, refer to their own documentation for timeout configuration/setup. read_timeout: If set, the receive timeout, will overwrite the total timeout.write_timeout: If set, the sending timeout, will overwrite the total timeout.connect_timeout: If set, the connection timeout will overwrite the total timeout.timeout: Total timeout, including all timeouts for connecting, sending, and receiving.This means these options are global for that client only. But it also allows you to set global timeout options for the class instance that is created.Įach client as seen in the example is created and each instance can set its own timeout configuration. Method Two: Using class set configurationĮach OpenSwoole coroutine client can be configured before being used, this allows you to setup things like SSL or EOF checking etc. This is the direct way to set a timeout but it must be set each time, so it is not very flexible. Most of the coroutine enabled clients allow you to pass in a $timeout parameter as a float, so 1.5 will mean 1.5 seconds. This timeout guide relates to the following coroutine Clients and API: This client has a few ways for how you can setup timeouts. All network requests (establish a connection, send data and receive data) may time out.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |