#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2016 Vale Tolpegin # Distributed under the terms of the MIT License. # -- Modules ------------------------------------------------------------------ from cleaner import Cleaner from Options import parseOptions # -- Start -------------------------------------------------------------------- Cleaner(*parseOptions())
from threading import currentThread os.chdir(dirname(abspath(__file__))) seed() from HTTPServer import LoadingServer preServer = LoadingServer() preServer.serve_bg() # We give stasis a single lock for all DiskMaps, but there will only be one DiskMap from rorn.Lock import getLock, setStackRecording from stasis.Lock import setMutexProvider setMutexProvider(lambda: getLock('#stasis')) from Options import option, parse as parseOptions parseOptions() Update.check() if option('lock-tracking'): setStackRecording(True) from stasis.Singleton import set as setDB from stasis.DiskMap import DiskMap from LoadValues import dbFilename def cacheLog(table): sys.__stdout__.write("[%s] [%s] %s\n" % (datetime.now().replace(microsecond = 0), 'stasis', "Backfilling table: %s" % table)) setDB(DiskMap(dbFilename, cache = True, nocache = ['log', 'sessions'], cacheNotifyFn = cacheLog)) from LoadValues import bricked from Log import console from Cron import Cron from HTTPServer import server as getServer, ServerError