aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2014-12-13 10:54:42 +0100
committerPetter Reinholdtsen <pere@hungry.com>2014-12-13 10:54:42 +0100
commita6b05e08fd045b7d50e46a469528120cc28dbde2 (patch)
tree867a9fbbefae55c613fa21846977ad4c18a3e2ad
parentb69a3b9cb76c71b3d303811e1cae91b33362784f (diff)
Handle unlimited CPU quota.
-rw-r--r--scrapersources/postliste-python-lib4
1 files changed, 2 insertions, 2 deletions
diff --git a/scrapersources/postliste-python-lib b/scrapersources/postliste-python-lib
index 7176ae9..0910afb 100644
--- a/scrapersources/postliste-python-lib
+++ b/scrapersources/postliste-python-lib
@@ -41,10 +41,10 @@ def exit_if_no_cpu_left(retval, callback=None, arg = None):
import resource
soft, hard = resource.getrlimit(resource.RLIMIT_CPU)
spent = cpu_spent()
- if soft < spent:
+ if -1 != soft and soft < spent:
if callback is not None:
callback(arg, spent, hard, soft)
- print "Running out of CPU, exiting."
+ print "Running out of CPU (%d < %d), exiting." % (soft, spent)
exit(retval)
def fetch_url_harder(url, scraper = None):