mirror of
https://github.com/oarkflow/mq.git
synced 2025-10-08 18:00:04 +08:00
feat: [wip] - implement storage
This commit is contained in:
@@ -9,12 +9,12 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
pool := mq.NewPool(2, 5, 1000, tasks.SchedulerHandler, tasks.SchedulerCallback)
|
||||
pool := mq.NewPool(2, 5, 1000, tasks.SchedulerHandler, tasks.SchedulerCallback, mq.NewMemoryTaskStorage(10*time.Minute))
|
||||
|
||||
time.Sleep(time.Millisecond)
|
||||
pool.AddTask(context.Background(), &mq.Task{ID: "Low Priority Task"}, 1)
|
||||
pool.AddTask(context.Background(), &mq.Task{ID: "Medium Priority Task"}, 5)
|
||||
pool.AddTask(context.Background(), &mq.Task{ID: "High Priority Task"}, 10)
|
||||
pool.EnqueueTask(context.Background(), &mq.Task{ID: "Low Priority Task"}, 1)
|
||||
pool.EnqueueTask(context.Background(), &mq.Task{ID: "Medium Priority Task"}, 5)
|
||||
pool.EnqueueTask(context.Background(), &mq.Task{ID: "High Priority Task"}, 10)
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
pool.PrintMetrics()
|
||||
|
Reference in New Issue
Block a user