def get_catalog_graph_data(): data = cache.get(CATALOG_SIZE_HISTORY_CACHE_KEY, None) if data is None: data = generate_catalog_graph_data() timeout = get_seconds_till_midnight() cache.set(CATALOG_SIZE_HISTORY_CACHE_KEY, data, timeout) return data
def __init__(self, ip='0.0.0.0', port=8123): self.port = port self.clients = {} self.storage = Storage(settings.BACKTRAC_BACKUP_ROOT) realm = BackupRealm() realm.server = self checker = BackupClientAuthChecker() self.portal = portal.Portal(realm, [checker]) self.factory = PBServerFactory(self.portal) context = ssl.DefaultOpenSSLContextFactory("server.key", "server.crt") self.service = SSLServer(self.port, self.factory, context, interface=ip) self.restore_loop = LoopingCall(self.execute_pending_restores) self.restore_loop.start(5) self.server_loop = LoopingCall(self.update_server_status) self.server_loop.start(5) self.catalog_backup_loop = LoopingCall(self.backup_catalog) deferLater(reactor, get_seconds_till_midnight(), self._start_catalog_backup_loop)