feat: implement Validate to check for cycle

This commit is contained in:
sujit
2024-10-23 14:11:39 +05:45
parent 9ca4e1c2f4
commit 1ec5630d3e
6 changed files with 112 additions and 57 deletions

View File

@@ -11,7 +11,13 @@ import (
func main() {
handler := tasks.SchedulerHandler
callback := tasks.SchedulerCallback
pool := mq.NewPool(3, 5, 1000, handler, callback, mq.NewMemoryTaskStorage(10*time.Minute))
pool := mq.NewPool(3,
mq.WithTaskQueueSize(5),
mq.WithMaxMemoryLoad(1000),
mq.WithHandler(handler),
mq.WithPoolCallback(callback),
mq.WithTaskStorage(mq.NewMemoryTaskStorage(10*time.Minute)),
)
ctx := context.Background()
pool.EnqueueTask(context.Background(), &mq.Task{ID: "Task 1"}, 1)
time.Sleep(1 * time.Second)