Reputation: 620
I haven't really found anything that categorically states this. If I set the Commandtimeout value for a connection object in npgsql, will that set it to wait indefinitely?
Upvotes: 3
Views: 5050
Reputation: 27955
Yes, 0 is infinite.
Npgqlstate.cs contains code below which as context.Mediator.CommandTimeout > 0
So if CommandTimeout is 0, Npgsql waits forever.
internal IEnumerable<IServerResponseObject> ProcessBackendResponsesEnum(NpgsqlConnector context,
bool cancelRequestCalled)
{
try
{
// Process commandTimeout behavior.
if ((context.Mediator.CommandTimeout > 0) &&
(!CheckForContextSocketAvailability(context, SelectMode.SelectRead)))
Upvotes: 4
Reputation: 7629
Please see the postgreSQL documentation:
PGCONNECT_TIMEOUT sets the maximum number of seconds that libpq will wait when attempting to connect to the PostgreSQL server. If unset or set to zero, libpq will wait indefinitely. It is not recommended to set the timeout to less than 2 seconds.
Upvotes: -2