fix to double-stacking queue problem and string-ize exceptions
This commit is contained in:
parent
fc1a311615
commit
b1d9151b08
@ -64,9 +64,9 @@ def main():
|
||||
# do all queued work
|
||||
work_queue.join()
|
||||
|
||||
else:
|
||||
# allow for a quiet period if queue is exhausted
|
||||
time.sleep(60)
|
||||
# sleep for a minute between attempts to check the queue
|
||||
time.sleep(60)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -87,10 +87,9 @@ class Client(object):
|
||||
url = doc['url'].replace(' ', '%20')
|
||||
data = self.scraper.urlopen(url)
|
||||
content_type = data.response.headers['content-type']
|
||||
except scrapelib.HTTPError as e:
|
||||
# TODO: log error
|
||||
except Exception as e:
|
||||
do_put = False
|
||||
error = e
|
||||
error = str(e)
|
||||
|
||||
# versioning is a concept for future use, but here's how it can work:
|
||||
# versioning functions take doc & data, and return True if data is
|
||||
@ -117,7 +116,6 @@ class Client(object):
|
||||
else:
|
||||
doc['_consecutive_errors'] = 0
|
||||
|
||||
|
||||
self.log('update', url=url, new_doc=do_put, error=error)
|
||||
|
||||
self.db.tracked.save(doc, safe=True)
|
||||
|
Loading…
Reference in New Issue
Block a user