Beispiel #1
0
def run_due():
    start_time = time.time()
    if not os.path.exists("assets/imagecache/"):
        os.makedirs("assets/imagecache/")
    loader.load_modules(packages=loader.GAME)
    if not stopped:
        for shard_number in range(0, shard_count):
            loaded_clients = len(shard_clients)
            shard_thread = ShardThread(asyncio.new_event_loop(), shard_number)
            shard_thread.start()
            while len(shard_clients) <= loaded_clients:
                pass
        while not loaded():
            pass
        loader.load_modules(packages=loader.COMMANDS)
        util.logger.info("Ready after %ds", time.time() - start_time)
        ### Tasks
        loop = asyncio.get_event_loop()
        from dueutil import tasks
        for task in tasks.tasks:
            asyncio.ensure_future(task(), loop=loop)
        loop.run_forever()
Beispiel #2
0
def run_bb():
    if not os.path.exists("assets/imagecache/"):
        os.makedirs("assets/imagecache/")
    loader.load_modules(packages=loader.GAME)
    if not stopped:
        loader.load_modules(packages=loader.COMMANDS)

        util.logger.info("Modules loaded after %.2fs",
                         time.time() - start_time)
        global shard_time
        shard_time = time.time()

        client_thread = ClientThread(asyncio.new_event_loop())
        client_thread.start()

        while client is None:
            pass

        ### Tasks
        loop = asyncio.get_event_loop()
        from dueutil import tasks
        for task in tasks.tasks:
            asyncio.ensure_future(task(), loop=loop)
        loop.run_forever()