Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add timeout option? #45

Closed
Draconic opened this issue Jul 3, 2019 · 2 comments
Closed

How to add timeout option? #45

Draconic opened this issue Jul 3, 2019 · 2 comments

Comments

@Draconic
Copy link
Contributor

Draconic commented Jul 3, 2019

Currently yii\httpclient\CurlTransport is used in order to make a request.
Unfortunately I was unable to find a way to pass CURLOPT_TIMEOUT to the transport and/or 'timeout' option to the Request. Is there such a way?

If no, I may try to work upon a solution for global client/transport config in class configuration options.

@sanchezzzhak
Copy link
Owner

sanchezzzhak commented Jul 3, 2019

Hi. Yes, there is such a possibility

    'requestConfig' => [
        'class' => 'kak\clickhouse\httpclient\Request',
        'options' => [
          'timeout' => 60
        ]
    ]

other allow options
https://www.yiiframework.com/extension/yiisoft/yii2-httpclient/doc/guide/2.0/en/usage-request-options

Full example config

return [ 
  'class' => 'kak\clickhouse\Connection',
   'dsn' => 'localhost',
   'database' => 'default',
   'port' => 8123,
   'username' => '{username}',
   'password' => '{password}',
   'enableSchemaCache' => true,
   'schemaCache' => 'cache',
   'schemaCacheDuration' => 86400,
    'options' => [
       'log_queries' => 1,                           // profile query view table system.log_queries
       'max_query_size' => 100000000    
    ],
    'requestConfig' => [
        'class' => 'kak\clickhouse\httpclient\Request',
        'options' => [
          'timeout' => 60
        ]
    ]
 
];

@Draconic
Copy link
Contributor Author

Draconic commented Jul 3, 2019

Thank you very much!
I believe the issue is closed then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants