mirror of https://github.com/scrapy/scrapy.git
Fix httpcache leveldb tests: gc.collect after del
LevelDB does not have "official" close method, so we have to rely on garbage collection to close it.
This commit is contained in:
parent
b4eb60e527
commit
a8df090071
|
|
@ -13,7 +13,7 @@ from scrapy.responsetypes import responsetypes
|
|||
from scrapy.utils.request import request_fingerprint
|
||||
from scrapy.utils.project import data_path
|
||||
from scrapy.utils.httpobj import urlparse_cached
|
||||
from scrapy.utils.python import to_bytes, to_unicode
|
||||
from scrapy.utils.python import to_bytes, to_unicode, garbage_collect
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -362,6 +362,7 @@ class LeveldbCacheStorage(object):
|
|||
# avoid them being removed in storages with timestamp-based autoremoval.
|
||||
self.db.CompactRange()
|
||||
del self.db
|
||||
garbage_collect()
|
||||
|
||||
def retrieve_response(self, spider, request):
|
||||
data = self._read_data(spider, request)
|
||||
|
|
|
|||
Loading…
Reference in New Issue