-
Notifications
You must be signed in to change notification settings - Fork 60
Block tarantool.Connect()
until a connection is established or the timeout expires if Reconnect
option set
#436
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
Comments
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
It'd be really nice if there was an option to make |
This is non-obvious behavior that is very confusing for users. It can be achieved now in the client code by writing a little code. We've act that way this before and have reject this behavior. |
We use the Go connector in Aeon (range-based sharding for Tarantool) and for us absence of something like the I guess it could be unacceptable to other users of the Go connector so I suggest disabling this feature by default, like it is disabled by default in net.box. OTOH I don't understand how it can be confusing. If you mean #136, when
Solving this problem in the application code doesn't look trivial to me: we'd have to start a background fiber that would call My point is that the situation when a connection hasn't been established yet isn't very different from the situation when it was temporarily broken due to a network error and the connector is trying to reconnect. If the connector supports reestablishing a connection on failure in the background, it should support establishing the initial connection in the background, as well. |
You could just to start a goroutine or implement the
And then the logic becomes even more confusing. In general, the request will wait for a connect. In corner cases, this will either dramatically complicate the code of the connector (and it's performance), or the user will still get an error on unlucky disconnect.
Yes, it is no different than if the connection is lost immediately after it is established and before a request. But in practice, it is not intuitive and people cannot use and handle the case properly. In addition, it complicates the connector configuration. Considering that this feature is rarely used, I don't want to make the connector code more complicated and make its behavior more complex and confusing. |
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
This patch makes Connect() retry connection attempts if opts.Reconnect is greater than 0. The delay between connection attempts is opts.Reconnect. If opts.MaxReconnects > 0 then the maximum number of attempts is equal to it, otherwise the maximum number of attempts is unlimited. Connect() now also blocks until a connection is established, provided context is cancelled or the number of attempts is exhausted. Closes #436
Currently
tarantool.Connect()
returns a connection if successfully connected to a Tarantool instance, or an error if the connection fails. It also ignores theReconnect
option on the first connection. This differs from the behavior ofnet.box
, which blocks and attempts to reconnect if thereconnect_after
option is non-nil. It is suggested thattarantool.Connect()
block until the context times out or a connection is established.The text was updated successfully, but these errors were encountered: