From cba387a0a06289c271253b1fe05eb5f5a7bd4e18 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 26 Jul 2012 15:42:04 +0200 Subject: [PATCH] Minor speed up --- lib/utils/hashdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index d906939b8..a2ae4cda4 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -6,6 +6,7 @@ See the file 'doc/COPYING' for copying permission """ import hashlib +import os import sqlite3 import threading import time @@ -54,7 +55,7 @@ class HashDB(object): def retrieve(self, key, unserialize=False): retVal = None - if key: + if key and (self._write_cache or os.path.isfile(self.filepath)): hash_ = HashDB.hashKey(key) retVal = self._write_cache.get(hash_, None) if not retVal: