async def test_state_manager_lock_warning_threshold_contend(
    state_manager_redis: StateManagerRedis,
    token: str,
    substate_token_redis: str,
    mocker: MockerFixture,
):
    """Test that the state manager triggers a warning when lock contention exceeds the warning threshold.

    Args:
        state_manager_redis: A state manager instance.
        token: A token.
        substate_token_redis: A token + substate name for looking up in state manager.
        mocker: Pytest mocker object.
    """
    console_warn = mocker.patch("reflex.utils.console.warn")

    state_manager_redis.lock_expiration = LOCK_EXPIRATION
    state_manager_redis.lock_warning_threshold = LOCK_WARNING_THRESHOLD

    order = []

    async def _coro_blocker():
        async with state_manager_redis.modify_state(substate_token_redis):
            order.append("blocker")
            await asyncio.sleep(LOCK_WARN_SLEEP)

    tasks = [
        asyncio.create_task(_coro_blocker()),
    ]

    await tasks[0]
    console_warn.assert_called()
    assert console_warn.call_count == 7
Test that the state manager triggers a warning when lock contention exceeds the warning threshold.

    Args:
        state_manager_redis: A state manager instance.
        token: A token.
        substate_token_redis: A token + substate name for looking up in state manager.
        mocker: Pytest mocker object.
    
tests/units/test_state.py