I have an application that is trying to connect to a rabbitmq-server, but I want my application to timeout within a specified number of seconds if it cannot connect to the server.
My problem is that I can't figure out how to do it.
to clarify, it's when my producer tries to connect that I want to timeout earlier, because now It takes up to 20-30 seconds.
If the library you're using makes use of the socket module (many do), a simple import socket; socket.setdefaulttimeout( SECONDS )
will suffice
[edited to include the correction by Daniel Figueroa]