Why do I send a message to a handler with the function in which await state.set_state ('name2) sends the following message to the next handler using await state.set_state (name1), the problem arises: if you send two messages at the same time, they will be processed both in the name1 handler.
But if you send two in order, then everything is normal and turns first in the first handler, and the next will be transferred to the second. In both, lock is used, but this does not help.
The same thing happens if you first send one message, it will be processed in the first handler. And if in a few seconds to send two more at the same time, then again both will be processed in the second.
@dp.message_handler(state='message_in_chat') async def send_message(message: types.Message): await bot.forward_message(id, message.from_user.id, message.message_id) with dp.current_state(chat=message.chat.id, user=message.from_user.id) as state: await state.set_state('message_two') @dp.message_handler(state='message_two') async def send_message2(message: types.Message): await bot.forward_message(id, message.from_user.id, message.message_id) with dp.current_state(chat=message.chat.id, user=message.from_user.id) as state: await state.set_state('message_in_chat')