Skip to content

Commit

Permalink
Update build stats at build end
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Nov 24, 2015
1 parent 5661448 commit 4daf387
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/DbBuilder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use ModulesPerl6::Model::Dists;

use Moo;
use namespace::clean;
use experimental 'postderef';

has _app => (
init_arg => 'app',
Expand Down Expand Up @@ -86,6 +87,8 @@ sub run {
);
}

$self->_save_build_stats;

if ( $self->_restart_app ) {
log info => 'Restarting app ' . $self->_app;
system $^O eq 'MSWin32'
Expand Down Expand Up @@ -146,6 +149,18 @@ sub _metas {
return @metas;
}

sub _save_build_stats {
my $self = shift;

ModulesPerl6::Model::BuildStats->new( db_file => $self->_db_file )->update(
last_updated => time(),
dists_num => scalar(
ModulesPerl6::Model::Dists->new( db_file => $self->_db_file )
->find->@*
),
);
}

1;

__END__

0 comments on commit 4daf387

Please sign in to comment.