use SAQueue and clear cache/queue tables on startup
This commit is contained in:
parent
cffe8cea08
commit
2a0898c928
@ -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)
|
||||
|
1
isso/cache/sa.py
vendored
1
isso/cache/sa.py
vendored
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user