Skip to content

Commit

Permalink
cleanup: Abort all operations when destroying download manager
Browse files Browse the repository at this point in the history
This was previously enforced only by the caller, but it makes more
sense to also enforce it at destroy(), which should always have the
last say in cancelation and cleanup.

Change-Id: I8c7a9f967383ed49104f673ba0ab239d28d69766
  • Loading branch information
joeyparrish committed Jul 20, 2021
1 parent 6757d23 commit 3270248
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/offline/download_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ shaka.offline.DownloadManager = class {

/** @private {!shaka.util.Destroyer} */
this.destroyer_ = new shaka.util.Destroyer(() => {
const promises = Array.from(this.groups_.values());
// Add a "catch" block to stop errors from being returned.
return Promise.all(promises.map((p) => p.catch(() => {})));
return this.abortAll().catch(() => {});
});

/**
Expand Down

0 comments on commit 3270248

Please sign in to comment.