Skip to content

Commit b7ee973

Browse files
author
Ivo Georgiev
committed
sentry_interface: merge the first page by joining iterators, therefore preserving order
1 parent a1366b8 commit b7ee973

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

validator_worker/src/sentry_interface.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,12 @@ pub async fn all_channels(
199199
if first_page.total_pages < 2 {
200200
Ok(first_page.channels)
201201
} else {
202-
let mut all: Vec<ChannelListResponse> =
202+
let all: Vec<ChannelListResponse> =
203203
try_join_all((1..first_page.total_pages).map(|i| fetch_page(url.clone(), i, &whoami)))
204204
.await?;
205205

206-
all.push(first_page);
207-
let result_all: Vec<Channel> = all
208-
.into_iter()
206+
let result_all: Vec<Channel> = std::iter::once(first_page)
207+
.chain(all.into_iter())
209208
.flat_map(|ch| ch.channels.into_iter())
210209
.collect();
211210
Ok(result_all)

0 commit comments

Comments
 (0)