Branch: Tag:

2016-02-17

2016-02-17 18:55:02 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Terminate threads when connections are idle.

618:    if(_options && _options.reconnect) // FIXME why can _options be 0?    _connectfail();    else -  catch(destruct(waitforauthready)); // FIXME why can it be 0? -  return; -  } -  } // Do not flush at this point, PostgreSQL 9.4 disapproves +  destruct(waitforauthready); +  } else // Do not flush at this point, PostgreSQL 9.4 disapproves    procmessage();    } -  + }      private void procmessage() {    int terminating=0;
1268:    _readyforquerycount=1;    _waittocommit=0;    qportals->write(1); -  if(!(c=getsocket())) -  ERROR("Couldn't connect to database on %s:%d\n",_host,_port); +  if(!getsocket()) { +  string msg=sprintf("Couldn't connect to database on %s:%d",_host,_port); +  if(force) { +  if(!sizeof(lastmessage) || lastmessage[sizeof(lastmessage)-1]!=msg) +  lastmessage+=({msg}); +  return 0; +  } else +  ERROR(msg+"\n"); +  }    _runtimeparameter=([]);    _unnamedportalmux=Thread.Mutex();    unnamedstatement=Thread.Mutex();