You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add a way to automatically reconnect if the mysql/mariadb database is restarted, I think this would be very easy to implement, just save the connection settings and check if it is necessary to reconnect every time you run a query.
Future<dynamic> reconnectIfNecessary() async {
try {
awaitthis.query('select true');
returnthis;
} catch (e) {
//when the database restarts there is a loss of connectionif ('$e'.contains('Cannot write to socket, it is closed')) {
var settings =newConnectionSettings(
host: mysqlConnInfoSite.host,
port: mysqlConnInfoSite.port,
user: mysqlConnInfoSite.username,
password: mysqlConnInfoSite.password,
db: mysqlConnInfoSite.database);
awaitthis.connect(settings);
returnthis;
}
rethrow;
}
}
The text was updated successfully, but these errors were encountered:
add a way to automatically reconnect if the mysql/mariadb database is restarted, I think this would be very easy to implement, just save the connection settings and check if it is necessary to reconnect every time you run a query.
The text was updated successfully, but these errors were encountered: