Improved stop download handling (#342)
This commit is contained in:
parent
f034b313b3
commit
425a83faec
2 changed files with 5 additions and 7 deletions
|
@ -30,6 +30,10 @@ export function doUpdateLoadStatus(uri, outpoint) {
|
||||||
full_status: true,
|
full_status: true,
|
||||||
}).then(([fileInfo]) => {
|
}).then(([fileInfo]) => {
|
||||||
if (!fileInfo || fileInfo.written_bytes === 0) {
|
if (!fileInfo || fileInfo.written_bytes === 0) {
|
||||||
|
// if the outpoint isn't in the state, then it was probably canceled, so stop checking the load status
|
||||||
|
const { downloadingByOutpoint = {} } = state.fileInfo;
|
||||||
|
if (!downloadingByOutpoint[outpoint]) return;
|
||||||
|
|
||||||
// download hasn't started yet
|
// download hasn't started yet
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dispatch(doUpdateLoadStatus(uri, outpoint));
|
dispatch(doUpdateLoadStatus(uri, outpoint));
|
||||||
|
@ -133,7 +137,7 @@ export function doStopDownloadingFile(uri, fileInfo) {
|
||||||
Lbry.file_set_status(params).then(() => {
|
Lbry.file_set_status(params).then(() => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.DOWNLOADING_CANCELED,
|
type: ACTIONS.DOWNLOADING_CANCELED,
|
||||||
data: {}
|
data: { uri, outpoint: fileInfo.outpoint }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Should also delete the file after the user stops downloading
|
// Should also delete the file after the user stops downloading
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
// This depends on the openjdk-8-jdk package (Ubuntu) being installed
|
|
||||||
compileJava {
|
|
||||||
options.fork = true
|
|
||||||
options.forkOptions.executable = /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
|
|
||||||
}
|
|
||||||
|
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
|
Loading…
Reference in a new issue