From 80e1c87653c01ccb67d011146c13fa02ed2f23d3 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 19 Oct 2011 16:53:44 -0400 Subject: [PATCH] TPac; Fetch authoritative user object in my-account Since user data changes in my-account, any time we fetch the fleshed user object, fetch it within a transaction to avoid retrieval from a (potentially lagging) DB replica. Signed-off-by: Bill Erickson Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index a1c2de47d7..a532bffc91 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -15,6 +15,11 @@ my $U = 'OpenILS::Application::AppUtils'; sub prepare_extended_user_info { my $self = shift; my @extra_flesh = @_; + my $e = $self->editor; + + # are we already in a transaction? + my $local_xact = !$e->{xact_id}; + $e->xact_begin if $local_xact; $self->ctx->{user} = $self->editor->retrieve_actor_user([ $self->ctx->{user}->id, @@ -25,7 +30,12 @@ sub prepare_extended_user_info { # ... } } - ]) or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; + ]); + + $e->rollback if $local_xact; + + return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR + unless $self->ctx->{user}; return; } -- 2.11.0