mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-16 13:48:09 -07:00
Only cancel the install of the extension being cancelled
This commit is contained in:
@@ -127,8 +127,10 @@ abstract class Installer(private val service: Service) {
|
||||
*/
|
||||
private fun cancelQueue(downloadId: Long) {
|
||||
val waitingInstall = this.waitingInstall.load()
|
||||
// Every new install cancels its own previous attempt first, which mustn't hit another extension's install
|
||||
val toCancel = synchronized(queue) { queue.find { it.downloadId == downloadId } }
|
||||
?: waitingInstall ?: return
|
||||
?: waitingInstall?.takeIf { it.downloadId == downloadId }
|
||||
?: return
|
||||
if (cancelEntry(toCancel)) {
|
||||
queue.remove(toCancel)
|
||||
if (waitingInstall == toCancel) {
|
||||
|
||||
Reference in New Issue
Block a user