From 8310798e413ea95024b90dc91e89df9142bcd28a Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 7 Jun 2010 14:56:59 +0200 Subject: [PATCH] don't rebuild stats if called from edit This allow us to rebuild stat just once after a bunch of edits or running ./script/actions-to-changes --- lib/MojoFacets/Data.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/MojoFacets/Data.pm b/lib/MojoFacets/Data.pm index d476867..63ddb57 100644 --- a/lib/MojoFacets/Data.pm +++ b/lib/MojoFacets/Data.pm @@ -255,9 +255,14 @@ sub _loaded { $self->redirect_to('/data/index') unless $path; if ( $loaded->{$path}->{modified} > 1 ) { - warn "rebuild stats for $path forced by modified\n"; - $loaded->{$path}->{stats} = __stats( $loaded->{$path}->{data}->{items} ); - $loaded->{$path}->{modified} = 1; + my $caller = (caller(1))[3]; + if ( $caller =~ m/::edit/ ) { + warn "rebuild stats for $path ignored caller $caller\n"; + } else { + warn "rebuild stats for $path FORCED by modified caller $caller\n"; + $loaded->{$path}->{stats} = __stats( $loaded->{$path}->{data}->{items} ); + $loaded->{$path}->{modified} = 1; + } } if ( ! defined $loaded->{$path}->{$name} ) { -- 2.20.1