Closed matcracker closed 2 years ago
It would be nice to sleep for 2^n seconds for the nth time this loop is executed.
Furthermore, logging connection failure would be preferrable.
So, you suggest me to increase the time of thread sleep every time it fails? Sounds good to me. In case of success the time is reset.
The connection failure is logged by default from mysqli.
You mean mysqli triggers a PHP warning implicitly? We probably want to suppress that with @
. Those messages won't get logged to server.log.
Right. I was thinking to use MainLogger but I don't like the idea, any other suggestions?
Forget it, I can't use the MainLogger.
Here is a result:
Why do you use the server logger? There is the plugin logger...
Why do you use the server logger? There is the plugin logger...
Because PluginLogger extends AttachableLogger and not AttachableThreadedLogger.
I just thought that in case of more than one disconnected worker, each one will try to reconnect and consequently there will be a spam of messages. I should think another way, do you?
I just thought that in case of more than one disconnected worker, each one will try to reconnect and consequently there will be a spam of messages. I should think another way, do you?
I don't think that's a problem. The reconnection status of each thread is independent, and the logger detects the current thread name anyway.
In case of shaded virions, the thread name contains the shaded namespace, so it should be clear which plugin it came from.
This would be awesome
please rebase the PR, looks good to me
Done!
In the case of disconnection from MySQL, libasynql was unable to restore the connection due to the exception thrown. The following PR has the following fix: in case of a failed ping to the database, the thread tries to restore the connection until successful and continue the execution of the queries in the queue.
I also wanted to propose to set a maximum number of attempts after which to throw an exception or to end the thread execution, what do you think?