Add ability to cancel get (download) request
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 493
- PR merge metrics
- No merged PRs in 30d
Description
## The Issue
Currently there is no easy way to stop a download once it has started. If you try to delete the file once get started, it can take over a minute for the response. If the file doesn't start properly (happened to me once), I was able to delete it but then the get request hung. Cancelling the request should ensure the file is deleted form file_list and from the harddisk.
It looks like get returns only after it starts downloading data blobs - we should have it return ASAP instead.
```
2018-05-11 15:02:17,483 INFO lbrynet.daemon.Downloader:93: Download lbry://ian-freeman-s-speeches-at-420-rally-in status changed to initializing
2018-05-11 15:02:17,486 INFO lbrynet.daemon.Downloader:93: Download lbry://ian-freeman-s-speeches-at-420-rally-in status changed to downloading_metadata
2018-05-11 15:02:33,065 INFO lbrynet.core.client.BlobRequester:414: Offered rate 0.000000/mb accepted by 71.203.35.184
2018-05-11 15:02:33,065 INFO lbrynet.core.client.BlobRequester:487: Requesting blob c03bff4b4e330f5d2f68d8fdd09423beffa30fb0ae6e8ccd734ce692f8efef453af2fb6409189890b814a5eadaaf92d1 from 71.203.35.184:3333
2018-05-11 15:02:33,161 INFO lbrynet.core.client.BlobRequester:563: Blob c03bff4b4e330f5d has been successfully downloaded from 71.203.35.184:3333
2018-05-11 15:02:33,569 INFO lbrynet.daemon.Downloader:186: Downloading lbry://ian-freeman-s-speeches-at-420-rally-in (c03bff) --> C:\Users\SoloDolo\Downloads\lbry downloads\ian-freeman-s-speeches-at-420_1.mp4
2018-05-11 15:02:33,569 INFO lbrynet.daemon.Downloader:93: Download lbry://ian-freeman-s-speeches-at-420-rally-in status changed to running
2018-05-11 15:03:08,582 INFO lbrynet.core.Wallet:395: Skipping dust
2018-05-11 15:04:18,035 INFO lbrynet.core.client.BlobRequester:414: Offered rate 0.000000/mb accepted by 47.17.162.103
2018-05-11 15:04:18,035 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 1d427cb2050866b7a92af9608f7f3679136a337f272ec46252cd436162b045ebee71ed35c3e0fe1bb6f41af84eec8e8b from 47.17.162.103:3352
2018-05-11 15:04:19,276 INFO lbrynet.core.client.BlobRequester:563: Blob 1d427cb2050866b7 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:19,289 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 52e455e8fa6d9fcadf424b19701e57be41c74fe6dff333075e61b972e7901baa680c3b665412cddb84ed2f1a239e07e6 from 47.17.162.103:3352
2018-05-11 15:04:20,331 INFO lbrynet.core.client.BlobRequester:563: Blob 52e455e8fa6d9fca has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:20,380 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 2ad2fdef682897924f8d18e8095eb588bef78aeeea64011ddb07edfd63d626c3ee227e4ce5459075d0d5d059ce06e684 from 47.17.162.103:3352
2018-05-11 15:04:21,506 INFO lbrynet.core.client.BlobRequester:563: Blob 2ad2fdef68289792 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:21,588 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 22a13109bfc9a67392d11a0bce24457acf318e3ccbb8bbd9ef51d3e460c2a5a45216149f93607928daa9dcfd85d5db24 from 47.17.162.103:3352
2018-05-11 15:04:22,750 INFO lbrynet.core.client.BlobRequester:563: Blob 22a13109bfc9a673 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:22,845 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 3a2d9e06a6c7e2f659c8b80ab6886a443b85a50418c035b28b90aa3a752615b885c45d2933cc50f979bd9d230622c491 from 47.17.162.103:3352
2018-05-11 15:04:24,361 INFO lbrynet.core.client.BlobRequester:563: Blob 3a2d9e06a6c7e2f6 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:24,456 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 692c9c2df96bb12f3a733f1e56e06d0de96fc7d295eedf602ec51c9a66783b248f472ce4618001d9d22f1b30e0d62f42 from 47.17.162.103:3352
2018-05-11 15:04:25,526 INFO lbrynet.core.client.BlobRequester:563: Blob 692c9c2df96bb12f has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:25,535 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 4ef2616505de4c00a6ed3bdc4f277223a000762342d764ff845ea88e10ab471dfa289ccc4fe62de7f65e16f76ba77649 from 47.17.162.103:3352
2018-05-11 15:04:26,667 INFO lbrynet.core.client.BlobRequester:563: Blob 4ef2616505de4c00 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:26,759 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 35f2f8f59debfb34e9800d6e426b0247f3b219243ed73bbb40165684b60d69e06e5711c252861236bd6c58f785bb0620 from 47.17.162.103:3352
2018-05-11 15:04:27,857 INFO lbrynet.core.client.BlobRequester:563: Blob 35f2f8f59debfb34 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:27,864 INFO lbrynet.core.client.BlobRequester:487: Requesting blob f4dd5ec12546ca5523a9654d6e8e1ee66657732bf7a88c73e1b8f4741db5dabaa61d768e0b6e23d27467ca23be41c18a from 47.17.162.103:3352
2018-05-11 15:04:28,921 INFO lbrynet.core.client.BlobRequester:563: Blob f4dd5ec12546ca55 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:28,930 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 86ef00f1f5ebb5d883b56d3591b15935bee7f72f220256d3758175e50516f7451b2dd1c79750d9f2612321bf66dc8b03 from 47.17.162.103:3352
2018-05-11 15:04:29,966 INFO lbrynet.core.client.BlobRequester:563: Blob 86ef00f1f5ebb5d8 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:30,006 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 8289e6b65fe36fe7fe4af4338ce8aa95db5d5055f5f5925bf9dd2d94f3c24d16890c95f43f667e5c1e5b59bd5a7c52e7 from 47.17.162.103:3352
2018-05-11 15:04:31,219 INFO lbrynet.core.client.BlobRequester:563: Blob 8289e6b65fe36fe7 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:31,227 INFO lbrynet.core.client.BlobRequester:487: Requesting blob e0b071d8740fdf695334bec560ba3f5864934ef0df4d61986c8ced8ff174bda741ff8045051f4582428afd2852127bd1 from 47.17.162.103:3352
2018-05-11 15:04:32,210 INFO lbrynet.core.client.BlobRequester:563: Blob e0b071d8740fdf69 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:32,292 INFO lbrynet.core.client.BlobRequester:487: Requesting blob 544f8fe514cf6eb648c55eae0ca591bb241ecacc5b3f58baffdc1241e66a33613e7c9ddb744ab07e88bcfe6baf5de677 from 47.17.162.103:3352
2018-05-11 15:04:33,322 INFO lbrynet.core.client.BlobRequester:563: Blob 544f8fe514cf6eb6 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:04:33,329 INFO lbrynet.core.client.BlobRequester:487: Requesting blob b8ef50ed0d4f2e89327d84456025214767d2394fc93c98a8a39f6efcee8ac6976b4cef74871e3f36fdd5268b8ace8d03 from 47.17.162.103:3352
2018-05-11 15:04:34,276 INFO lbrynet.core.client.BlobRequester:563: Blob b8ef50ed0d4f2e89 has been successfully downloaded from 47.17.162.103:3352
2018-05-11 15:05:08,648 INFO lbrynet.core.Wallet:395: Skipping dust
2018-05-11 15:05:29,446 INFO lbrynet.daemon.Downloader:93: Download lbry://ian-freeman-s-speeches-at-420-rally-in status changed to stopped
2018-05-11 15:05:29,446 INFO lbrynet.daemon.Downloader:149: Finished downloading lbry://ian-freeman-s-speeches-at-420-rally-in (c03bff) --> C:\Users\SoloDolo\Downloads\lbry downloads\ian-freeman-s-speeches-at-420_1.mp4
2018-05-11 15:05:29,566 INFO lbrynet.daemon.Daemon:1793: Deleted file: ian-freeman-s-speeches-at-420_1.mp4
```
### Steps to reproduce
1.
2.
3.
### Expected behaviour
Tell us what should happen
### Actual behaviour
Tell us what happens instead
## System Configuration
- LBRY Daemon version:
- LBRY App version:
- LBRY Installation ID:
- Operating system:
## Anything Else
## Screenshots
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the daemon's get request and the lbrynet.daemon.Downloader flow described in the logs, including how stopping or deleting a download is handled. Define completion as allowing an in-progress get request to be cancelled promptly while removing its file-list entry and downloaded file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100