optimize SingleSession to avoid unneeded session fetches (#2536)
This commit is contained in:
parent
1d35a5dc84
commit
87295178e0
|
@ -65,6 +65,16 @@ sub run {
|
|||
my $moduleOptions = $self->conf->{globalStorageOptions} || {};
|
||||
$moduleOptions->{backend} = $self->conf->{globalStorage};
|
||||
|
||||
my $singleSessionRuleMatched =
|
||||
$self->singleSessionRule->( $req, $req->sessionInfo );
|
||||
my $singleIPRuleMatched = $self->singleIPRule->( $req, $req->sessionInfo );
|
||||
my $singleUserByIPRuleMatched =
|
||||
$self->singleUserByIPRule->( $req, $req->sessionInfo );
|
||||
|
||||
if ( $singleSessionRuleMatched
|
||||
or $singleIPRuleMatched
|
||||
or $self->conf->{notifyOther} )
|
||||
{
|
||||
my $sessions = $self->module->searchOn(
|
||||
$moduleOptions,
|
||||
$self->conf->{whatToTrace},
|
||||
|
@ -88,7 +98,8 @@ sub run {
|
|||
if (
|
||||
$self->singleSessionRule->( $req, $req->sessionInfo )
|
||||
or ( $self->singleIPRule->( $req, $req->sessionInfo )
|
||||
and $req->{sessionInfo}->{ipAddr} ne $session->data->{ipAddr} )
|
||||
and $req->{sessionInfo}->{ipAddr} ne
|
||||
$session->data->{ipAddr} )
|
||||
)
|
||||
{
|
||||
push @$deleted, $self->p->_sumUpSession( $session->data );
|
||||
|
@ -99,6 +110,7 @@ sub run {
|
|||
push @otherSessionsId, $id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$token = $self->ott->createToken( {
|
||||
user => $req->{sessionInfo}->{ $self->conf->{whatToTrace} },
|
||||
|
@ -106,7 +118,7 @@ sub run {
|
|||
}
|
||||
) if @otherSessionsId;
|
||||
|
||||
if ( $self->singleUserByIPRule->( $req, $req->sessionInfo ) ) {
|
||||
if ($singleUserByIPRuleMatched) {
|
||||
my $sessions =
|
||||
$self->module->searchOn( $moduleOptions, 'ipAddr',
|
||||
$req->sessionInfo->{ipAddr} );
|
||||
|
|
Loading…
Reference in New Issue
Block a user