We don't really want to profile generation of html from profile data :-)
DB::disable_profile();
return unless my $id = $c->stash('nytprof.id');
my $duration = Time::HiRes::gettimeofday() - $id;
- if ( $duration > $p ) {
+ if ( $c->stash('nytprof.disabled') ) {
+ warn "profile disabled";
+ unlink $path;
+ } elsif ( $duration > $p ) {
my $path = "/tmp/nytprof.$id";
my $new = "/tmp/MojoFacets.profile.$id-$duration";
rename $path, $new;
if ( my $profile = $self->param('profile') ) {
warn "XXX profile $profile\n";
my $dir = $self->app->home->rel_dir('public') . "/profile/$profile";
- mkpath $dir unless -d $dir;
- system "nytprofhtml --file $path$profile --out $dir";
+ if ( ! -e $dir ) {
+ mkpath $dir unless -d $dir;
+ system "nytprofhtml --file $path$profile --out $dir";
+ $self->stash( 'nytprof.disabled' => 1 );
+ }
$self->redirect_to("/profile/$profile/index.html");
}