At the end of the issue there is a very basic echo bot with debug enabled
When the bot is off, type in the chat messages:
1
2
3
4
5
6
7
8
Then launch the bot. The log (simplified):
[TGBOT] [DEBUG] request url: https://api.telegram.org/botFOO:BAR/getMe, payload: null
[TGBOT] [DEBUG] response from 'https://api.telegram.org/botFOO:BAR/getMe' with payload '{"ok":true,"result":{"id":botbotbot,"is_bot":true,...,"can_join_groups":true,"can_read_all_group_messages":false,"supports_inline_queries":false}}'
[TGBOT] [DEBUG] response from 'https://api.telegram.org/botFOO:BAR/getUpdates' with payload '{"ok":true,"result":[
{"update_id":180259658,"message":{"message_id":95,"from":{"...},"chat":{...},"date":1709399995,"text":"1"}},
{"update_id":180259659,"message":{"message_id":96,"from":{"...},"chat":{...},"date":1709399995,"text":"2"}},
{"update_id":180259660,"message":{"message_id":97,"from":{"...},"chat":{...},"date":1709399996,"text":"3"}},
{"update_id":180259661,"message":{"message_id":98,"from":{"...},"chat":{...},"date":1709399996,"text":"4"}},
{"update_id":180259662,"message":{"message_id":99,"from":{"...},"chat":{...},"date":1709399999,"text":"5"}},
{"update_id":180259663,"message":{"message_id":100,"from":{"...},"chat":{...},"date":1709400000,"text":"6"}},
{"update_id":180259664,"message":{"message_id":101,"from":{"...},"chat":{...},"date":1709400000,"text":"7"}},
{"update_id":180259665,"message":{"message_id":102,"from":{"...},"chat":{...},"date":1709400001,"text":"8"}}
]}'
INFO received message: text=8
INFO received message: text=4
INFO received message: text=5
INFO received message: text=7
INFO received message: text=1
INFO received message: text=6
INFO received message: text=2
INFO received message: text=3
TG server returns updates in order: messages in the array result are in the ascending order of update_id.
But the handler receives the messages in a random order.
Are there options to ensure the order of the updates in the handler?
Indeed, now messages may arrive out of order due to implementation features (launching processing workers in goroutines). I'll look into what can be done soon
At the end of the issue there is a very basic echo bot with debug enabled
When the bot is off, type in the chat messages:
Then launch the bot. The log (simplified):
TG server returns updates in order: messages in the array result are in the ascending order of update_id. But the handler receives the messages in a random order.
Are there options to ensure the order of the updates in the handler?
The program: