• Hi there, the plugin works very well, in general. Today it skipped a post, and investigating in the log files I found this:

    [2020-02-01 13:15:23]
    Method: sendPhoto
    Params: {“parse_mode”:”HTML”,”disable_notification”:false,”photo”:”https:\/\/www.mysite.foo\/wp-content\/uploads\/2020\/01\/machine_1280.jpg”,”caption”:”Article content”,”reply_markup”:”{\”inline_keyboard\”:[[{\”text\”:\”\\ud83d\\udd17 Leggi articolo\”,\”url\”:\”https:\\\/\\\/www.mysite.foo\\\/article-slug\\\/\”}]]}”,”chat_id”:”-1001418552813″}
    ——————————–
    WP_Error: http_request_failed cURL error 28: Operation timed out after 20001 milliseconds with 0 bytes received

    Would you consider thinking of adding some sort of retry logic (or re-schedule the task a minute later or something similar) when timeouts happen? Otherwise the message is lost.
    I do understand the need to drop malformed messages (i.e. I had another one where the user had inserted a BMP image as opposed to a GIF or JPG and telegram puked at it) but for transient network conditions maybe this needs some special handling?

    Thanks,

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi, thanks for the suggestion. I have added it to the list 🙂

    Thread Starter Daniele Muscetta

    (@dani3l3)

    Hi we’ve had another occurrence of this today. It’s about once a day or less, this is a busy site where there’s an average of a post every half an hour or less (about 50-55 posts a day), so it’s still a small percentage, but it does happen.

    Since I would like to keep a close eye on this but I am afraid the logs would grow too large, do you have plans for a rollover/rotate policy or should I (may I?) include it in my log rotate config?

    File size of the logs should never go beyond 512kb

    Thread Starter Daniele Muscetta

    (@dani3l3)

    Thanks. Is there a way to increase the timeout, even if just for testing (i.e. code change)?

    Pretty simple:

    add_filter( 'wptelegram_bot_api_request_arg_timeout', function ( $timeout ) {
    
    	$timeout = 20; // 20 seconds by default
    
    	return $timeout;
    }, 10, 1 );

    You can see in the error above that the operation timed out after 20 seconds (20000 milliseconds).

    Thread Starter Daniele Muscetta

    (@dani3l3)

    Thank you I will try increasing it a little bit (30sec) for testing and keep an eye on it… I suspect there might be slightly larger images that could be causing it rather than a widespread network issues… I’ll let you know how it goes.

    Thread Starter Daniele Muscetta

    (@dani3l3)

    After changing timeout to 30s from the original 20, we’ve hard 24 hours without timeout issues. I guess it’s just a busy site and maybe some post images are too large, which was causing the timeout. I’ll keep monitoring but is seems this has helped. Thanks a lot.

    You are welcome. You may consider writing a review 🙂

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Retry on timeouts?’ is closed to new replies.