Adding a limit of requests.
This commit is contained in:
parent
1117f6d52f
commit
8d685edec1
21
Build.PL
21
Build.PL
|
@ -9,16 +9,17 @@ my $build = Module::Build->new(
|
||||||
dist_author => 'Sergio Iglesias <contact@owlcode.tech>',
|
dist_author => 'Sergio Iglesias <contact@owlcode.tech>',
|
||||||
dist_abstract => 'Tg bot to generate mtg pdfs.',
|
dist_abstract => 'Tg bot to generate mtg pdfs.',
|
||||||
requires => {
|
requires => {
|
||||||
'Mojolicious' => 0,
|
'Mojolicious' => 0,
|
||||||
'Path::Tiny' => 0,
|
'Path::Tiny' => 0,
|
||||||
'Moo' => 0,
|
'Moo' => 0,
|
||||||
'DBI' => 0,
|
'DBI' => 0,
|
||||||
'DBD::SQLite' => 0,
|
'DBD::SQLite' => 0,
|
||||||
'PDF::API2' => 0,
|
'PDF::API2' => 0,
|
||||||
'PDF::API2::XS' => 0,
|
'PDF::API2::XS' => 0,
|
||||||
'Image::PNG::Libpng' => 0,
|
'Image::PNG::Libpng' => 0,
|
||||||
'YAML::PP' => 0,
|
'YAML::PP' => 0,
|
||||||
'DateTime' => 0,
|
'DateTime' => 0,
|
||||||
|
'Mojo::UserAgent::Role::Queued' => 0,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
$build->create_build_script;
|
$build->create_build_script;
|
||||||
|
|
|
@ -25,7 +25,10 @@ has last_invalid_card => (
|
||||||
has _ua => ( is => 'lazy', );
|
has _ua => ( is => 'lazy', );
|
||||||
|
|
||||||
sub _build__ua {
|
sub _build__ua {
|
||||||
return Mojo::UserAgent->new;
|
my $ua = Mojo::UserAgent->new->with_roles('+Queued');
|
||||||
|
$ua->max_active(5);
|
||||||
|
$ua->inactivity_timeout(60);
|
||||||
|
return $ua;
|
||||||
}
|
}
|
||||||
|
|
||||||
our $ERR_TOO_MANY_CARDS = 'TOO_MANY_CARDS';
|
our $ERR_TOO_MANY_CARDS = 'TOO_MANY_CARDS';
|
||||||
|
|
|
@ -156,7 +156,8 @@ sub _pdf_builder {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _build__ua ($self) {
|
sub _build__ua ($self) {
|
||||||
my $ua = Mojo::UserAgent->new;
|
my $ua = Mojo::UserAgent->new->with_roles('+Queued');
|
||||||
|
$ua->max_active(5);
|
||||||
$ua->inactivity_timeout(60);
|
$ua->inactivity_timeout(60);
|
||||||
return $ua;
|
return $ua;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue