5
56
Fork
You've already forked grammers
24

Use DC from Downloadable to mitigate FILE_MIGRATE_ERROR #53

Merged
Lonami merged 1 commit from HACEKOMOE/grammers:download-dc-id-fix into master 2026年07月13日 17:48:41 +02:00
Contributor
Copy link

Added .dc_id() method to Downloadable, so now all media downloading code uses it to avoid FILE_MIGRATE_ERROR on downloads. Falls back to the home DC if the media doesn't specify one.
Also I replaced heavy tokio::sync::Mutex with simple std::sync::atomic::AtomicI64 which is a better fit for handing out part indices.

Added `.dc_id()` method to `Downloadable`, so now all media downloading code uses it to avoid `FILE_MIGRATE_ERROR` on downloads. Falls back to the home DC if the media doesn't specify one. Also I replaced heavy `tokio::sync::Mutex` with simple `std::sync::atomic::AtomicI64` which is a better fit for handing out part indices.
Lonami left a comment
Copy link

Thanks, this is a nice change.

Thanks, this is a nice change.
@ -281,3 +291,1 @@
letmuti=part_index.lock().await;
*i+=1;
MAX_CHUNK_SIZEasi64*(*i-1)
leti=part_index.fetch_add(1,std::sync::atomic::Ordering::Relaxed);
Owner
Copy link

Hm... I'm not familiar with atomic orderings that much but relaxed seems correct, since we just need an ever-increasing counter.

Hm... I'm not familiar with atomic orderings that much but relaxed seems correct, since we just need an ever-increasing counter.
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Lonami/grammers!53
Reference in a new issue
Lonami/grammers
No description provided.
Delete branch "HACEKOMOE/grammers:download-dc-id-fix"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?