Skip to content

Commit

Permalink
Ensure any import items finished after pause sent to UI
Browse files Browse the repository at this point in the history
- they will be finished anyway, but the user will have no idea about them as the message never got sent
- this way the message will always send, even if it's after the time the user presses pause btn
  • Loading branch information
poltak committed Mar 16, 2018
1 parent e11a964 commit 316b496
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/imports/background/import-progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,13 @@ class ImportProgressManager {
} finally {
processor.finished = true

// Send item data + outcome status down to UI (and error if present)
if (!this.stopped) {
this.observer.next(msg)

// Either flag as error or remove from state depending on processing error status
if (msg.error && !this.processErrors) {
await stateManager.flagItemAsError(chunkKey, encodedUrl)
} else {
await stateManager.removeItem(chunkKey, encodedUrl)
}
this.observer.next(msg)

// Either flag as error or remove from state depending on processing error status
if (msg.error && !this.processErrors) {
await stateManager.flagItemAsError(chunkKey, encodedUrl)
} else {
await stateManager.removeItem(chunkKey, encodedUrl)
}
}
}
Expand Down

0 comments on commit 316b496

Please sign in to comment.