35 lines
484 B
Go
35 lines
484 B
Go
package fusenrender
|
|
|
|
import (
|
|
"log"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestQueue(t *testing.T) {
|
|
q, err := NewQueue("/tmp/fusenrender")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
group := "fusen"
|
|
|
|
q.Enqueue(&QueueItem{
|
|
Group: group,
|
|
Priority: 1,
|
|
CreateAt: time.Now(),
|
|
Data: nil,
|
|
})
|
|
|
|
q.Enqueue(&QueueItem{
|
|
Group: group,
|
|
Priority: 2,
|
|
CreateAt: time.Now(),
|
|
Data: nil,
|
|
})
|
|
|
|
log.Println(q.Dequeue(group))
|
|
log.Println(q.Dequeue(group))
|
|
log.Println(q.Dequeue(group))
|
|
}
|