Skip to content
Snippets Groups Projects
Commit 6d6b225e authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Implementing timeout options

parent 5da04236
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,9 @@ class Config
$options = [];
if (defined(qrs_db_option_tsqueryfunction) && null !== qrs_db_option_tsqueryfunction)
$options['tsqueryfunction'] = qrs_db_option_tsqueryfunction;
$options['timeout'] = (defined(qrs_db_option_timeout) && null !== qrs_db_option_timeout) ? qrs_db_option_timeout : 5000;
if (defined(qrs_db_connector) && null !== qrs_db_connector)
return new Config(qrs_path_prefix, qrs_db_connector, qrs_db_user, qrs_db_pass, qrs_backend, $options);
else
......
......@@ -12,7 +12,8 @@ class PostgresSmartBackend implements Backend
function __construct(\PDO $db, array $options)
{
$this->db = $db;
$this->db->exec("SET statement_timeout = 5000;");
$timeout = $options["timeout"];
$this->db->exec("SET statement_timeout = $timeout;");
$this->options = $options;
}
......
......@@ -3,13 +3,15 @@ define('qrs_db_host', 'example.com');
define('qrs_db_port', 5432);
define('qrs_db_name', 'quassel');
//Only change this if you know what you are doing
// Only change this if you know what you are doing
define('qrs_db_connector', null);
define('qrs_db_user', 'quassel');
define('qrs_db_pass', 'password');
define('qrs_db_option_tsqueryfunction', "plainto_tsquery('english', :query)");
// Timeout in milliseconds
define('qrs_db_option_timeout', 5000);
define('qrs_backend', 'pgsql-smart');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment