[Rt-commit] rt branch, 4.4/lazy-role-groups, updated. rt-4.4.4-454-g010e46892a

Jim Brandt jbrandt at bestpractical.com
Fri May 28 09:21:37 EDT 2021


The branch, 4.4/lazy-role-groups has been updated
       via  010e46892af5fe60286bebac80d886de2cd50264 (commit)
       via  1760c8c3e808a67715a53bbf7d0d169f81936dda (commit)
      from  de4d823b4fb45d5faada95c9c1d66aaa25d0f159 (commit)

Summary of changes:
 lib/RT/Record/Role/Roles.pm | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 1760c8c3e808a67715a53bbf7d0d169f81936dda
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 28 09:20:37 2021 -0400

    Add documentation for lazy role groups

diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
index 37025cf862..fd430ed56e 100644
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
@@ -54,7 +54,7 @@ use Role::Basic;
 use Scalar::Util qw(blessed);
 
 # Set this to true to lazily create role groups
-our $LAZY_ROLE_GROUPS;
+our $LAZY_ROLE_GROUPS = 0;
 
 =head1 NAME
 
@@ -811,5 +811,31 @@ sub LabelForRole {
     return $role->{Name};
 }
 
+=head1 OPTIONS
+
+=head2 Lazy Role Groups
+
+Role groups are typically created for all roles on a ticket or asset when
+that object is created. If you are creating a large number of tickets or
+assets automatically (e.g., with an automated import process) and you use
+custom roles in addition to core roles, this requires many additional rows
+to be created for each base ticket or asset. This adds time to the create
+process for each ticket or asset.
+
+Roles support a lazy option that will defer creating the underlying role
+groups until the object is accessed later. This speeds up the initial
+create process with minimal impact if tickets or assets are accessed
+individually later (like a user loading a ticket and working on it).
+
+This lazy behavior is off by default for backward compatibility. To
+enable it, set this package variable:
+
+    $RT::Record::Role::Roles::LAZY_ROLE_GROUPS = 1;
+
+If you are evaluating this option for performance, it's worthwhile to
+benchmark your ticket or asset create process before and after to confirm
+you see faster create times.
+
+=cut
 
 1;

commit 010e46892af5fe60286bebac80d886de2cd50264
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 28 09:21:24 2021 -0400

    Convert pod link to private method to code format

diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
index fd430ed56e..cd15c5ec8f 100644
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
@@ -140,7 +140,7 @@ as such is not managed by the core codebase or an extension.
 =item CreateGroupPredicate
 
 Optional.  A subroutine whose return value indicates whether the group for this
-role should be created as part of L</_CreateRoleGroups>.  When this subroutine
+role should be created as part of C<_CreateRoleGroups>.  When this subroutine
 is not provided, the group will be created.  The same parameters that will be
 passed to L<RT::Group/CreateRoleGroup> are passed to your predicate (including
 C<Object>)

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


More information about the rt-commit mailing list