Missing handlers but there we goddamn GO
Former-commit-id: 2505146a54acaf18eadfdebf1dd2720889aef795
This commit is contained in:
Binary file not shown.
@@ -40,9 +40,9 @@ func (i *Item) Compare(other queue.Item) int {
|
||||
iNext := i.Last().Add(i.Interval())
|
||||
jNext := j.Last().Add(j.Interval())
|
||||
if iNext.Before(jNext) {
|
||||
return 1
|
||||
} else if jNext.Before(iNext) {
|
||||
return -1
|
||||
} else if jNext.Before(iNext) {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestItemCompare(t *testing.T) {
|
||||
|
||||
i, _ := NewItem("iCompare", time.Second)
|
||||
j, _ := NewItem("jCompare", 10*time.Second)
|
||||
if c := i.Compare(j); c != -1 {
|
||||
if c := i.Compare(j); c != 1 {
|
||||
t.Fatal(c)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ func TestItemCompare(t *testing.T) {
|
||||
|
||||
i, _ = NewItem("iCompare", 10*time.Second)
|
||||
j, _ = NewItem("jCompare", time.Second)
|
||||
if c := i.Compare(j); c != 1 {
|
||||
if c := i.Compare(j); c != -1 {
|
||||
t.Fatal(c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package monitor
|
||||
|
||||
import (
|
||||
"local/rssmon3/config"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -51,6 +52,8 @@ func (m *Monitor) triggered() <-chan time.Time {
|
||||
if top == nil {
|
||||
return nil
|
||||
}
|
||||
block := time.Until(top.Last().Add(top.Interval()))
|
||||
log.Printf("blocking %v until next task", block)
|
||||
return time.After(time.Until(top.Last().Add(top.Interval())))
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ func TestQueuePriority(t *testing.T) {
|
||||
j, _ := NewItem("jQueuePriority", time.Hour)
|
||||
q.Push(i)
|
||||
q.Push(j)
|
||||
if k := q.Peek(); k.Key != "iQueuePriority" {
|
||||
if k := q.Peek(); k.Key != "jQueuePriority" {
|
||||
t.Errorf("compare is backwards")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user