Esempio n. 1
0
    def test_connection_pool_release_clean_race_condition(self):
        pool = ConnectionPool(max_host_count=1)

        connection = yield From(pool.acquire('127.0.0.1', 1234))
        connection_2_task = trollius.async(pool.acquire('127.0.0.1', 1234))
        yield From(trollius.sleep(0.01))
        pool.no_wait_release(connection)
        yield From(pool.clean(force=True))
        connection_2 = yield From(connection_2_task)

        # This line should not KeyError crash:
        yield From(pool.release(connection_2))
Esempio n. 2
0
    def test_connection_pool_release_clean_race_condition(self):
        pool = ConnectionPool(max_host_count=1)

        connection = yield From(pool.acquire('127.0.0.1', 1234))
        connection_2_task = trollius. async (pool.acquire('127.0.0.1', 1234))
        yield From(trollius.sleep(0.01))
        pool.no_wait_release(connection)
        yield From(pool.clean(force=True))
        connection_2 = yield From(connection_2_task)

        # This line should not KeyError crash:
        yield From(pool.release(connection_2))