diff options
author | Valery Piashchynski <[email protected]> | 2021-07-05 18:44:29 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-07-05 18:44:29 +0300 |
commit | 207739f7346c98e16087547bc510e1f909671260 (patch) | |
tree | 5c6eac27beb4eb5e127c7d8dae3464edb3359be9 /pkg/priority_queue/pq.go | |
parent | 300166eda7b138847008a7653f90753bd8397b9e (diff) |
- Update PQ
- Update ephemeral plugin, complete Push
- Add Jobs full configuration
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/priority_queue/pq.go')
-rw-r--r-- | pkg/priority_queue/pq.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/pkg/priority_queue/pq.go b/pkg/priority_queue/pq.go index 1b33cb92..2ff52a79 100644 --- a/pkg/priority_queue/pq.go +++ b/pkg/priority_queue/pq.go @@ -1,6 +1,10 @@ package priorityqueue -import "sync" +import ( + "sync" + + priorityqueue "github.com/spiral/roadrunner/v2/common/priority_queue" +) type PQ struct { sync.RWMutex @@ -13,14 +17,14 @@ func NewPriorityQueue() *PQ { } } -func (p *PQ) Insert(item PQItem) { +func (p *PQ) GetMax() priorityqueue.Item { p.Lock() - p.bh.Insert(item) - p.Unlock() + defer p.Unlock() + return p.bh.GetMax() } -func (p *PQ) Get() PQItem { +func (p *PQ) Insert(item priorityqueue.Item) { p.Lock() - defer p.Unlock() - return p.bh.GetMax() + p.bh.Insert(item) + p.Unlock() } |