Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pomelo MySql .net core 2 - default execution timeout

we are using Pomelo MySql in production environment for half a year and it works just fine but occassionally we are getting exception like so:

MySql.Data.MySqlClient.MySqlException: The Command Timeout expired before the operation completed.

Connection string in appsettings.json looks like this:

"MySqlConnection": "server=somesql;userid=user;password=pass;database=test;"

so nothing fancy.

My question is what is the default command execution timeout in pomelo? How can I change it through connection string?

Executing code like this inside DbContext

var timeout = Database.GetCommandTimeout();

gives me always null value.

like image 945
Macko Avatar asked Oct 20 '25 14:10

Macko


1 Answers

Try increasing the command timeout (in seconds) in your connection string by specifying default command timeout.

In your case your connection string should look like:

server=somesql;userid=user;password=pass;database=test;default command timeout=120;
like image 100
Aministrator Avatar answered Oct 22 '25 04:10

Aministrator



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!