updateQueueStatus for an on-going tracked extraction. This is called from a channel callback to update status in a single go routine. This is used by apps and Folders in a few other places as well.
(data *newStatus, now time.Time, sendHook bool)
| 627 | // This is called from a channel callback to update status in a single go routine. |
| 628 | // This is used by apps and Folders in a few other places as well. |
| 629 | func (u *Unpackerr) updateQueueStatus(data *newStatus, now time.Time, sendHook bool) *Extract { |
| 630 | if _, ok := u.Map[data.Name]; !ok { |
| 631 | // This is a new Folder being queued for extraction. |
| 632 | // Arr apps do not land here. They create their own queued items in u.Map. |
| 633 | u.Map[data.Name] = &Extract{ |
| 634 | Path: data.Name, |
| 635 | App: FolderString, |
| 636 | Status: QUEUED, |
| 637 | Updated: now, |
| 638 | IDs: map[string]any{"title": data.Name}, // required or webhook may break. |
| 639 | } |
| 640 | |
| 641 | u.Map[data.Name].XProg = &ExtractProgress{Extract: u.Map[data.Name]} |
| 642 | |
| 643 | if sendHook { |
| 644 | u.runAllHooks(u.Map[data.Name]) |
| 645 | } |
| 646 | |
| 647 | return u.Map[data.Name] |
| 648 | } |
| 649 | |
| 650 | if data.Resp != nil { |
| 651 | u.Map[data.Name].Resp = data.Resp |
| 652 | } |
| 653 | |
| 654 | u.Map[data.Name].Status = data.Status |
| 655 | u.Map[data.Name].Updated = now |
| 656 | |
| 657 | if sendHook { |
| 658 | u.runAllHooks(u.Map[data.Name]) |
| 659 | } |
| 660 | |
| 661 | return u.Map[data.Name] |
| 662 | } |
no test coverage detected