From: gfawcett Date: Thu, 14 Oct 2010 02:38:43 +0000 (+0000) Subject: be a bit more defensive w.r.t. network outages. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b3ce1eea20147bdf259bddfb37cf95ad6755ec19;p=Syrup.git be a bit more defensive w.r.t. network outages. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1041 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/integration/uwindsor.py b/conifer/integration/uwindsor.py index 5dfb8c0..230ed96 100644 --- a/conifer/integration/uwindsor.py +++ b/conifer/integration/uwindsor.py @@ -81,18 +81,21 @@ CACHE_TIME = 300 @memoize(timeout=CACHE_TIME) def _item_status(bib_id): if bib_id: - counts = E1('open-ils.search.biblio.copy_counts.location.summary.retrieve', - bib_id, 1, 0) - lib = desk = avail = 0 - for org, callnum, loc, stats in counts: - avail_here = stats.get(AVAILABLE, 0) - anystatus_here = sum(stats.values()) - if loc == RESERVES_DESK_NAME: - desk += anystatus_here - avail += avail_here - lib += anystatus_here - return (lib, desk, avail) - + try: + counts = E1('open-ils.search.biblio.copy_counts.location.summary.retrieve', + bib_id, 1, 0) + lib = desk = avail = 0 + for org, callnum, loc, stats in counts: + avail_here = stats.get(AVAILABLE, 0) + anystatus_here = sum(stats.values()) + if loc == RESERVES_DESK_NAME: + desk += anystatus_here + avail += avail_here + lib += anystatus_here + return (lib, desk, avail) + except: + pass # fail silently if there's an opensrf related error. + return None def cat_search(query, start=1, limit=10): if query.startswith(EG_BASE):