Adding single worker handling gts.
This commit is contained in:
parent
6a900050a3
commit
72e7459492
1
Build.PL
1
Build.PL
@ -20,6 +20,7 @@ my $build = Module::Build->new(
|
||||
'JSON' => 0,
|
||||
'UUID::URandom' => 0,
|
||||
'DateTime::Format::Mail' => 0,
|
||||
'Path::Tiny' => 0,
|
||||
},
|
||||
);
|
||||
$build->create_build_script;
|
||||
|
@ -18,6 +18,7 @@ use DateTime;
|
||||
use DateTime::Format::Pg;
|
||||
use JSON;
|
||||
use UUID::URandom qw/create_uuid_string/;
|
||||
use Path::Tiny;
|
||||
|
||||
use GTSRSSApi::DB;
|
||||
|
||||
@ -55,6 +56,16 @@ sub startup ($self) {
|
||||
$r->get('/computer-all.rss')->to('Page#computer_all_rss');
|
||||
$r->get('/computer-shiny.rss')->to('Page#computer_shiny_rss');
|
||||
$r->get('/computer-pokerus.rss')->to('Page#computer_pokerus_rss');
|
||||
|
||||
my $pidfile = path('/run/gtsrssapi.pid');
|
||||
my $gts_bot_pid = path('last_pid_started_gts_bot');
|
||||
if (-f $pidfile) {
|
||||
my $pidfile_content = $pidfile->slurp;
|
||||
if ($pidfile_content eq $gts_bot_pid->slurp) {
|
||||
return;
|
||||
}
|
||||
$gts_bot_pid->spew($pidfile_content);
|
||||
}
|
||||
$self->start_gts_bot;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user