diff --git a/isso/__init__.py b/isso/__init__.py index 899d7c3..de442fb 100644 --- a/isso/__init__.py +++ b/isso/__init__.py @@ -175,18 +175,19 @@ class Isso(object): def make_app(conf): - dbobj = db.Adapter(conf.get("general", "dbpath")) if uwsgi is not None: cacheobj = cache.uWSGICache(timeout=3600) else: cacheobj = cache.SACache(conf.get("general", "dbpath"), threshold=2048) + dbobj = db.Adapter(conf.get("general", "dbpath")) + jobs = tasks.Jobs() jobs.register("db-purge", dbobj, conf.getint("moderation", "purge-after")) jobs.register("http-fetch", dbobj) - queueobj = queue.Queue(1024) + queueobj = queue.SAQueue(conf.get("general", "dbpath"), 1024) worker = queue.Worker(queueobj, jobs) isso = Isso(conf, cacheobj, dbobj) diff --git a/isso/cache/sa.py b/isso/cache/sa.py index 40c70a3..4faaf7c 100644 --- a/isso/cache/sa.py +++ b/isso/cache/sa.py @@ -71,6 +71,7 @@ class SACache(Base): Column("time", Float)) self.metadata.create_all(self.engine) + self.engine.execute(self.cache.delete()) def _get(self, ns, key): return get(self.engine.connect(), self.cache, ns + b'-' + key) diff --git a/isso/queue/sa.py b/isso/queue/sa.py index c72ceea..ba2a47a 100644 --- a/isso/queue/sa.py +++ b/isso/queue/sa.py @@ -32,6 +32,7 @@ class SAQueue(Queue): Column("wait", Float)) self.metadata.create_all(self.engine) + self.engine.execute(self.queue.delete()) def put(self, item): with self.engine.begin() as con: