zachfeldman / rubypress

Ruby interface for the WordPress XMLRPC API. Follows standard XML-RPC Documentation closely.
201 stars 55 forks source link

Catch 'Errno::EPIPE: Broken pipe' and reconnect. #45

Closed cpcerrato closed 9 years ago

cpcerrato commented 9 years ago

After two or three seconds of inactivity I get Catch 'Errno::EPIPE: Broken pipe'. After show error, the connection work fine again at the next execution. I add the exception Errno::EPIPE to xml_rpc_retryable.rb RUBY_EXCEPTIONS array and include a test.

I got the exception ussing rubypress inside a docker container based on ubunbu 14:04 with ruby 1.9.3p484 installed with bundler rubypress (1.1.0).

Feel free for refactor the code. Regards and thanks for this great tool.

zachfeldman commented 9 years ago

You're welcome - but doesn't this just mean that your internet connection went down?

cpcerrato commented 9 years ago

The container is running in the same host that my wordpress, and I have no issues with network. You can see how docker network works here [1].

[1] https://docs.docker.com/articles/networking/

zachfeldman commented 9 years ago

Ok - can you confirm that all tests pass with this patch?

cpcerrato commented 9 years ago

Sorry for the delay, I have been busy but finally I could get the time to test the the patch properly. It passed all test with ruby versions 2.2.0, 2.1.2, and 1.9.3.

To get all tests green it's needed to fill more environment variables, that readme file specifies:

WORDPRESS_PATH="/xmlrpc.php" (if not defined 33 test fails) I think this value should be set by default if not defined in environment variable. WORDPRESS_HTTP_LOGIN (if not set, #httpAuth #validAuth and #invalidAuth fails) instead the variable specified in the README.md file: WORDPRESS_HTTP_USERNAME WORDPRESS_HTTP_PASS ((if not set, #httpAuth #validAuth fails) WORDPRESS_HTTP_PATH=/ (if not set, #httpAuth #validAuth and #invalidAuth fails)

Sorry again for the delay.

Regards.

zachfeldman commented 9 years ago

Merged, about to push to Rubygems (all tests have passed)