When scrolling to the end of channel history, you can see logs similar to the ones below:
Discord: get_messages: GetMessages { search_filter: None, limit: Some(50) }
Discord: get_messages: GetMessages { search_filter: Some(Before(MessageId(InnerId(1307281599834099833)))), limit: Some(50) }
Discord gave us 50 messages (out of 50)
Discord: get_messages: GetMessages { search_filter: Some(Before(MessageId(InnerId(1307256815993491477)))), limit: Some(50) }
Discord gave us 43 messages (out of 50)
Discord: get_messages: GetMessages { search_filter: Some(Before(MessageId(InnerId(1307138812673265764)))), limit: Some(50) }
Discord gave us 0 messages (out of 50)
Here, the last call to discord (GetMessages { search_filter: Some(Before(MessageId(InnerId(1307138812673265764)))), limit: Some(50) }), is entirely unnecessary as the previous call returned 43 items (less then the requested 50), meaning the channel reached it's end. Ideally the app would not need to make this call.