mailchimp-api icon indicating copy to clipboard operation
mailchimp-api copied to clipboard

General Timeout Variable

Open jpvaillancourt opened this issue 6 years ago • 9 comments

I would be easier to be able to change the timeout with a client method or variable instead of passing it into each calls.

Do you want me to make the changes and make a pull request?

jpvaillancourt avatar Apr 03 '18 20:04 jpvaillancourt

You can actually change the default in one central place using the TIMEOUT constant. Is that insufficient?

Are you finding the 10 second default too short? The MailChimp API is usually much, much faster than that.

drewm avatar Apr 03 '18 20:04 drewm

The problem is that we cannot change it since it's a constant.

Yeah I know that the API is usually much faster, but I had some issues in the past month where some very simple calls took more than 13-14 seconds. As simple as creating a campaign or getting a list's ID. I have talked to the Mailchimp support about this issue and they are supposed too take a look at it.

And the execution time is the one from their logs and not mine so it's clearly on their end.

2018-04-03 20:00:03 GMT | POST /campaigns/ | php | 14.363s | DrewM/MailChimp-API/3.0

jpvaillancourt avatar Apr 03 '18 21:04 jpvaillancourt

In that case, I'd be more interested to see self::TIMEOUT be replaced with static::TIMEOUT so that the constant could be overridden by inheritance.

At the same time, it might be an idea to make the private classes protected.

drewm avatar Apr 04 '18 09:04 drewm

I find it a bit overkill to force a user to create a new class just to change some configurations.

It would be cleaner I think if you create an array of options that could be passed in the constructor, overriding some default parameters.

And adding a getOptions() setOptions() methods to modify them.

jpvaillancourt avatar Apr 04 '18 20:04 jpvaillancourt

+1 for this. Also experiencing problems with timeouts after just 10 seconds.

driade avatar Feb 23 '19 09:02 driade

Hello, good morning. @drewm Would something like this be accepted?

https://github.com/drewm/mailchimp-api/compare/master...driade:allow_timeout_configuration?expand=1

Thanks in advance

driade avatar Feb 23 '19 10:02 driade

ping? still suffering from this...

driade avatar Jun 19 '19 08:06 driade

Sure, I don't see why not.

drewm avatar Jul 01 '19 14:07 drewm

There you're https://github.com/drewm/mailchimp-api/pull/276 , thanks in advance.

driade avatar Jul 01 '19 15:07 driade