func (a *worker) addObject(obj *scanner.Object) {
	a.m.Lock()
	defer a.m.Unlock()
	opq, ok := a.objects[obj.UID]
	if !ok {
		opq := &objectspq{obj}
		a.objects[obj.UID] = opq
		heap.Init(opq)
		return
	}
	if idx := opq.Index(obj); idx >= 0 {
		(*opq)[idx] = obj
		return
	}
	heap.Push(opq, obj)
}
addObject will add (or replace!) an object to the collection of objects.
Each object is stored in its own priority queue, and if an object with the
same priority is to be added, it will replace the object instead.
package agent
import (
	"container/heap"
	"github.com/joyrex2001/nightshift/internal/scanner"
)
type objectspq []*scanner.Object
func (pq objectspq) Len() int {
	return len(pq)
}
func (pq objectspq) Less(i, j int) bool {
	return pq[i].Priority > pq[j].Priority
}
func (pq objectspq) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}
func (pq *objectspq) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	*pq = old[0 : n-1]
	return item
}
func (pq *objectspq) Push(x interface{}) {
	item := x.(*scanner.Object)
	*pq = append(*pq, item)
}
func (pq objectspq) Index(obj *scanner.Object) int {
	for i, o := range pq {
		if o.Priority == obj.Priority {
			return i
		}
	}
	return -1
}
func (a *worker) InitObjects() {
	a.m.Lock()
	defer a.m.Unlock()
	a.objects = map[string]*objectspq{}
}
func (a *worker) GetObjects() map[string]*scanner.Object {
	a.m.Lock()
	defer a.m.Unlock()
	objs := map[string]*scanner.Object{}
	for _, opq := range a.objects {
		if len(*opq) > 0 {
			obj := (*opq)[0].Copy()
			objs[obj.UID] = obj
		}
	}
	return objs
}