[Rt-commit] rt branch 5.0/env-query-timeout-on-connect created. rt-5.0.3-255-g2ea72ff107

BPS Git Server git at git.bestpractical.com
Thu Feb 16 13:31:52 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/env-query-timeout-on-connect has been created
        at  2ea72ff107a5341446bc462a202ae55889fef12a (commit)

- Log -----------------------------------------------------------------
commit 2ea72ff107a5341446bc462a202ae55889fef12a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Feb 16 21:07:15 2023 +0800

    Respect env "RT_DATABASE_QUERY_TIMEOUT" on db connect
    
    The PostLoadCheck hook does update "DatabaseQueryTimeout" if env is set,
    but it's run after db connect, so we can't rely on it on db connect.
    Still, the hook is useful as admins can get the real timeout setting
    from system configuration page.

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 5b63911441..92dd8ac33e 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -127,7 +127,10 @@ sub Connect {
         %args,
     );
 
-    my $timeout = RT->Config->Get('DatabaseQueryTimeout');
+    my $timeout
+        = defined $ENV{RT_DATABASE_QUERY_TIMEOUT} && length $ENV{RT_DATABASE_QUERY_TIMEOUT}
+        ? $ENV{RT_DATABASE_QUERY_TIMEOUT}
+        : RT->Config->Get('DatabaseQueryTimeout');
     if ( $db_type eq 'mysql' ) {
         # set the character set
         $self->dbh->do("SET NAMES 'utf8mb4'");

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list