Skip to content

Commit

Permalink
fix: validate the length of hit messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Pugma committed Oct 4, 2024
1 parent 177ff50 commit d49eb4f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/app/src/traq/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ pub(super) async fn collect(

// check whether all messages are retrieved
if MESSAGE_LIMIT * (page + 1) >= result.total_hits as i32 {
if !hit_messages.is_empty() {
break;
}

// get the timestamp from the latest message
*checkpoint = hit_messages.last().unwrap().created_at.clone();
info!("Updated last_checkpoint = {}", *checkpoint);
break;
Expand Down

0 comments on commit d49eb4f

Please sign in to comment.