commit 962efcca978f385d249e085a5662c0c8e413ff93
parent ebbcac8e89556ddce9f94104d69b7bac281e9b1d
Author: Paco Esteban <paco@onna.be>
Date: Thu, 22 Mar 2018 13:31:47 +0100
torrentapi time limit makes the module crash. I have added a silly _sleep_ ... Also we now check beter the token
Diffstat:
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/Changes b/Changes
@@ -1,6 +1,8 @@
Revision history for Rarbg-torrentapi
{{$NEXT}}
+ - torrentapi time request limit was making the module crash ...
+ Also, the token validity is better tested now.
v0.1.6 2018-03-21 16:16:44 CET
- Torrentapi now needs app_id.
diff --git a/lib/Rarbg/torrentapi.pm b/lib/Rarbg/torrentapi.pm
@@ -86,6 +86,7 @@ sub _renew_token {
my $self = shift;
my $url = $BASEURL . "get_token=get_token&app_id=" . $self->app_id;
my $res_json = $self->_ua->get($url);
+ sleep 1;
if ( $res_json->is_success ) {
$self->_token_time(time);
my $res = decode_json( $res_json->decoded_content );
@@ -103,7 +104,9 @@ sub _token_valid {
sub _make_request {
my $self = shift;
- $self->_renew_token unless $self->_token_valid;
+ unless ($self->_token_valid) {
+ $self->_token($self->_renew_token);
+ }
my $url = $BASEURL;
foreach my $attribute ( $self->meta->get_attribute_list ) {
next if $attribute =~ /^_/;