xmltv/grab Get_nice.pm,1.34,1.35
Geoff <[email protected]> Thu, 16 Feb 2017 13:20:10 +0000
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv27614
Modified Files:
Get_nice.pm
Log Message:
Skip get_nice sleep for cached pages (credit Mike Parker) (patches #99)
Index: Get_nice.pm
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/Get_nice.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** Get_nice.pm 11 Aug 2015 09:16:09 -0000 1.34
--- Get_nice.pm 16 Feb 2017 13:20:08 -0000 1.35
***************
*** 131,138 ****
my $last_get_time;
sub get_nice_aux( $ ) {
my $url = shift;
! if (defined $last_get_time) {
# A page has already been retrieved recently. See if we need
# to sleep for a while before getting the next page - being
--- 131,139 ----
my $last_get_time;
+ my $last_get_from_cache;
sub get_nice_aux( $ ) {
my $url = shift;
! if (defined $last_get_time && (defined $last_get_from_cache && !$last_get_from_cache) ) {
# A page has already been retrieved recently. See if we need
# to sleep for a while before getting the next page - being
***************
*** 158,161 ****
--- 159,165 ----
$Response = $r;
+ # set flag if last fetch was from cache
+ $last_get_from_cache = (defined $r->{'_headers'}{'x-cached'} && $r->{'_headers'}{'x-cached'} == 1);
+
if ($r->is_error) {
# At the moment download failures seem rare, so the script dies if
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot