Bug 40136: (follow-up) Avoid DateTime inflation in _unblessed_for_log

Switch from unblessed() to get_column() so that date/datetime column
values are returned as raw ISO strings directly from DBIC's internal
storage, without constructing DateTime objects that would only be
immediately stringified. This makes _unblessed_for_log cheaper on every
call, which is particularly noticeable in the test suite where
BorrowersLog defaults to enabled and patron stores are frequent.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-03-25 09:44:33 +01:00
parent 89aa40cc1e
commit 062d24f101
No known key found for this signature in database
GPG Key ID: 2D86E0EAEC83711B
1 changed files with 9 additions and 9 deletions

View File

@ -3755,16 +3755,16 @@ ISO string representation, and sensitive/noisy fields are excluded.
sub _unblessed_for_log {
my ($self) = @_;
my $data = $self->unblessed;
delete @{$data}{qw(password lastseen updated_on)};
for my $key ( keys %$data ) {
if ( defined $data->{$key} && $data->{$key} ne '' ) {
$data->{$key} = "$data->{$key}" if blessed( $data->{$key} );
} else {
delete $data->{$key};
}
# Use get_column rather than unblessed to avoid DBIC column inflation:
# date/datetime values are returned as raw ISO strings directly, without
# constructing DateTime objects that we would only immediately stringify.
my %data = map { $_ => $self->get_column($_) } $self->result_source->columns;
delete @data{qw(password lastseen updated_on)};
for my $key ( keys %data ) {
delete $data{$key} unless defined $data{$key} && $data{$key} ne '';
}
return $data;
return \%data;
}
=head1 AUTHORS