zim32 / mysql.dart

MySQL client for Dart written in Dart
BSD 3-Clause "New" or "Revised" License
64 stars 17 forks source link

TimeoutException after 0:00:10.000000: Future not completed #36

Closed harald-schafer closed 1 year ago

harald-schafer commented 1 year ago

Any call to execute or execute prepared statement that takes longer than 10 seconds will fail with a timeout. Timeout of 10 seconds is hardcoded in various places i.e. in function execute()

// wait for ready state if (_state != _MySQLConnectionState.connectionEstablished) { await _waitForState(_MySQLConnectionState.connectionEstablished) .timeout(Duration(seconds: 10)); }

Would it be please possible to add an optional parameter of type Duration with standard value Duration(seconds: 10) so in case of longer SQL statement user can put a bigger number of seconds than 10. Thanks.

harald-schafer commented 1 year ago

Thanks @dukefirehawk I think for single connection the implemented solution works. For Pool connections I don't see how to specify the timeout.

dukefirehawk commented 1 year ago

@harald-schafer My use case only needed the timeout for single connection hence only implemented for it. As for pooled connections, I think you could add the timeout parameter to MySQLConnectionPool constructor in the file pool.dart and then pass it to await conn.connect(); at line 126. Then test out to see if that works for your use case.

zim32 commented 1 year ago

Added in 0.0.27. See pool constructor, now it is possible to pass timeout when creating pool