From edbf3386ff692b205986fa68bb9fafb90d138553 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 9 Jun 2021 17:56:41 -0400 Subject: [PATCH] LP1901930 Improve existing session detection Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm index b767ce801a..7974990a22 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm @@ -130,8 +130,7 @@ sub set_ils_account { login_type => 'staff' }; - $args->{workstation} = $account->workstation->name - if $account->workstation; + $args->{workstation} = $account->workstation->name if $account->workstation; my $auth = $U->simplereq( 'open-ils.auth_internal', @@ -160,6 +159,12 @@ sub set_ils_account { $e->xact_begin; + # Always confirm a matching session does not exist before attempting + # to create one. + $ses = $e->retrieve_sip_session([ + $seskey, {flesh => 1, flesh_fields => {sipses => ['account']}}]) + unless $ses; + if ($ses) { # ILS token expired on an existing SIP session. # Update the session to use the new token. -- 2.11.0