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 <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
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,
# ...
}
}
- ]) 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;
}