From 3917061e28d36ebc47662752e9d02577c7032af6 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 18 Apr 2020 19:22:47 +0200 Subject: [PATCH] crawler: improve sqlite back end Autocommit & fixed a bug --- morss/crawler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morss/crawler.py b/morss/crawler.py index 6cbaf94..70dffd7 100644 --- a/morss/crawler.py +++ b/morss/crawler.py @@ -482,7 +482,7 @@ import sqlite3 class SQLiteCache(BaseCache): def __init__(self, filename=':memory:'): - self.con = sqlite3.connect(filename or sqlite_default, detect_types=sqlite3.PARSE_DECLTYPES, check_same_thread=False) + self.con = sqlite3.connect(filename, detect_types=sqlite3.PARSE_DECLTYPES, check_same_thread=False, isolation_level=None) with self.con: self.con.execute('CREATE TABLE IF NOT EXISTS data (url UNICODE PRIMARY KEY, code INT, msg UNICODE, headers UNICODE, data BLOB, timestamp INT)')