diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2014-12-13 10:54:42 +0100 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2014-12-13 10:54:42 +0100 |
commit | a6b05e08fd045b7d50e46a469528120cc28dbde2 (patch) | |
tree | 867a9fbbefae55c613fa21846977ad4c18a3e2ad | |
parent | b69a3b9cb76c71b3d303811e1cae91b33362784f (diff) |
Handle unlimited CPU quota.
-rw-r--r-- | scrapersources/postliste-python-lib | 4 |
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): |