From 23b65b87bb2b5d0faee49946f9be4cb2fa27a23f Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Wed, 17 Jan 2024 13:22:09 -0800 Subject: [PATCH] fix panic --- pkg/unpackerr/handlers.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/unpackerr/handlers.go b/pkg/unpackerr/handlers.go index 2e5b789d..2dfbafe4 100644 --- a/pkg/unpackerr/handlers.go +++ b/pkg/unpackerr/handlers.go @@ -185,6 +185,10 @@ func (u *Unpackerr) checkExtractDone() { // handleXtractrCallback handles callbacks from the xtractr library for starr apps (not folders). // This takes the provided info and logs it then sends it the queue update method. func (u *Unpackerr) handleXtractrCallback(resp *xtractr.Response) { + if item := u.Map[resp.X.Name]; resp.Done && item != nil { + u.updateMetrics(resp, item.App, item.URL) + } + switch { case !resp.Done: u.Printf("Extraction Started: %s, items in queue: %d", resp.X.Name, resp.Queued) @@ -192,12 +196,10 @@ func (u *Unpackerr) handleXtractrCallback(resp *xtractr.Response) { case resp.Error != nil: u.Printf("Extraction Error: %s: %v", resp.X.Name, resp.Error) u.updateQueueStatus(&newStatus{Name: resp.X.Name, Status: EXTRACTFAILED, Resp: resp}, true) - u.updateMetrics(resp, u.Map[resp.X.Name].App, u.Map[resp.X.Name].URL) default: u.Printf("Extraction Finished: %s => elapsed: %v, archives: %d, extra archives: %d, "+ "files extracted: %d, wrote: %dMiB", resp.X.Name, resp.Elapsed.Round(time.Second), len(resp.Archives), len(resp.Extras), len(resp.NewFiles), resp.Size/mebiByte) - u.updateMetrics(resp, u.Map[resp.X.Name].App, u.Map[resp.X.Name].URL) u.updateQueueStatus(&newStatus{Name: resp.X.Name, Status: EXTRACTED, Resp: resp}, true) } }