Skip to content

Commit

Permalink
Merge pull request #376 from Unpackerr/dn2_panic_fix
Browse files Browse the repository at this point in the history
fix panic
  • Loading branch information
davidnewhall authored Jan 17, 2024
2 parents ab1a2ab + 23b65b8 commit cf9ce3a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/unpackerr/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,21 @@ 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)
u.updateQueueStatus(&newStatus{Name: resp.X.Name, Status: EXTRACTING, Resp: resp}, true)
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)
}
}
Expand Down

0 comments on commit cf9ce3a

Please sign in to comment.