Skip to content

Commit

Permalink
Tweak stats initialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
mherger committed Apr 11, 2024
1 parent 9ba6757 commit 22e94aa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Slim/Plugin/Stats/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ use constant REPORT_INTERVAL => 86400 * 7;

my $serverPrefs = preferences('server');

my $log = Slim::Utils::Log->addLogCategory({
'category' => 'plugin.stats',
'defaultLevel' => 'WARN',
'description' => __PACKAGE__->getDisplayName(),
});

my $log;
my $id;

sub initPlugin {
# delay init, as we want to be sure we're enabled before trying to read the display name
sub postinitPlugin {
$id ||= sha1_base64(preferences('server')->get('server_uuid'));

$log = Slim::Utils::Log->addLogCategory({
'category' => 'plugin.stats',
'defaultLevel' => 'WARN',
'description' => __PACKAGE__->getDisplayName(),
});

Slim::Utils::Timers::setTimer($id, time() + REPORT_DELAY, \&_reportStats);
}

Expand Down

0 comments on commit 22e94aa

Please sign in to comment.