def __init__(self): from apps import apps self.apps_cycle = apps.keys() self.index = cycle(range(len(self.apps_cycle))) self.lock = threading.RLock()
import mysignal import threading from apps import apps import urllib2 import logging import traceback import socket socket.setdefaulttimeout(30) class State(object): INIT = 0 CHECK = 1 NOTEXIST = 2 EXPORT = 3 apps = apps.keys() class Store(object): BATCH_SAVE_LIMIT = 20 def __init__(self, config): self.config = config self.apps = cycle(apps) self.users = [] self.lock = threading.RLock() self.app_len = len(apps) self._batchs = {} self.init() self.cache_ct = 0 self.repeat_ct = 0 self.save_ct = 0