示例#1
0
    def __init__(self, uid, host, port, boss_port):
        self.uid = uid
        self.boss_port = boss_port
        self.host = host
        self.port = port
        self.boss_api_handler = BossClient(host, boss_port).boss_access

        if in_parent_process():
            save_pid_file('pretenders-mock-{0}.pid'.format(uid))
示例#2
0
def run(host, port):
    """
    Run the maintainer.

    Which regularly triggers the boss to delete stale Mock servers.
    """
    boss_client = BossClient(host, port)
    while True:
        time.sleep(STALE_DELETE_FREQUENCY)
        boss_client.boss_access.http('DELETE', url='/smtp?stale=1')
        boss_client.boss_access.http('DELETE', url='/http?stale=1')