mirror of
https://github.com/spartanz51/tutabridge.git
synced 2026-06-24 10:54:32 +02:00
Fetch the whole folder when sync_limit is 0 ("all")
Previously sync_limit=0 still loaded a single 1000-entry page, so the mailbox was effectively capped. Use the SDK's paginated load_all to walk the entire MailSetEntry list when the limit is 0, keeping a single capped load_range for a finite limit. Live-tested: with sync_limit=0, INBOX loads all 19288 mails (was capped at 500) with stable UIDs 1..19288.
This commit is contained in:
+16
-10
@@ -121,16 +121,22 @@ impl TutaSession {
|
||||
entries_list_id: &tutasdk::GeneratedId,
|
||||
limit: usize,
|
||||
) -> Result<Vec<Mail>, ApiCallError> {
|
||||
let count = if limit == 0 { 1000 } else { limit };
|
||||
let entries: Vec<MailSetEntry> = self
|
||||
.crypto_client()
|
||||
.load_range(
|
||||
entries_list_id,
|
||||
&CustomId::default(),
|
||||
count,
|
||||
ListLoadDirection::DESC,
|
||||
)
|
||||
.await?;
|
||||
// limit == 0 means "all": paginate the whole entries list. Otherwise
|
||||
// load a single capped page (newest first).
|
||||
let entries: Vec<MailSetEntry> = if limit == 0 {
|
||||
self.crypto_client()
|
||||
.load_all(entries_list_id, ListLoadDirection::DESC)
|
||||
.await?
|
||||
} else {
|
||||
self.crypto_client()
|
||||
.load_range(
|
||||
entries_list_id,
|
||||
&CustomId::default(),
|
||||
limit,
|
||||
ListLoadDirection::DESC,
|
||||
)
|
||||
.await?
|
||||
};
|
||||
|
||||
// Group entries by list_id for batch loading
|
||||
let mut by_list: std::collections::HashMap<String, Vec<tutasdk::GeneratedId>> =
|
||||
|
||||
Reference in New Issue
Block a user