OHMySQL icon indicating copy to clipboard operation
OHMySQL copied to clipboard

[Query] Is there a mechanism for connection timeout if the server we are attempting to connect is unavailable?

Open clarencechng opened this issue 1 year ago • 2 comments

Hi there! Thanks for the wonderful library for making connections from iOS to MySQL database an easy process! I would like to clarify if there is any mechanisms for us to set a timeout property when calling the coordinator.connect() function? Currently an issue is that when setting the MySQL server ip address to a non existent ip address (to simulate a scenario when the server is down), it seems that the coordinator.connect() function attempts to reconnect itself and takes about 1 min 20 seconds before it gives up and returning the proper ResultErrorType for my codes to do the proper error handling.

It would be great if there was an option to i) allow user to disable reconnections if the first attempt to connect to the database has failed, OR ii) allow the user to specify a timeout input to set the maximum time for the method to attempt to reconnect before giving up and returning the proper error codes.

Looking forward to your response. Thanks in advance!

Running on latest version of OHMySQL 3.1.0

clarencechng avatar Jul 10 '22 14:07 clarencechng

Hi @clarencechng

Thanks for reaching me out. Good input!

Unfortunately, you cannot specify a timeout for now. It can be good improvement. So, I'm going to update the library.

oleghnidets avatar Jul 11 '22 08:07 oleghnidets

Thank you! Looking forward to your next update!

clarencechng avatar Jul 11 '22 13:07 clarencechng

Hello is there any progress on that? Library is great but I have a scenario where wifi signal can be lost during connection and the app crashes due to that..

karkadah avatar Nov 21 '22 14:11 karkadah

Hi Work is in progress, I'm updating a source code to make code more stable in the future. PR #35 Unfortunately, it takes a time and I manage it only in my free time-slots, so I cannot pay enough attention to this issue right now.

Consider, creating custom timer and abort the connection if it's not configured. You may use this property to check connection.

oleghnidets avatar Nov 21 '22 19:11 oleghnidets

Hey @clarencechng @karkadah Please, check the release 3.2.1.

oleghnidets avatar Jul 07 '23 21:07 oleghnidets