mirror of
https://github.com/acaloiaro/neoq
synced 2026-07-22 02:36:55 +00:00
examples: Cleanup
This commit is contained in:
parent
6a368e05fc
commit
86955cb40c
2 changed files with 0 additions and 4 deletions
|
|
@ -41,7 +41,6 @@ func main() {
|
||||||
log.Println("error listening to queue", err)
|
log.Println("error listening to queue", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// enqueue a job
|
|
||||||
_, err = nq.Enqueue(ctx, &jobs.Job{
|
_, err = nq.Enqueue(ctx, &jobs.Job{
|
||||||
Queue: queue,
|
Queue: queue,
|
||||||
Payload: map[string]interface{}{
|
Payload: map[string]interface{}{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/acaloiaro/neoq"
|
"github.com/acaloiaro/neoq"
|
||||||
"github.com/acaloiaro/neoq/backends/postgres"
|
"github.com/acaloiaro/neoq/backends/postgres"
|
||||||
|
|
@ -26,7 +25,6 @@ func main() {
|
||||||
|
|
||||||
h := handler.New(queue, func(ctx context.Context) (err error) {
|
h := handler.New(queue, func(ctx context.Context) (err error) {
|
||||||
var j *jobs.Job
|
var j *jobs.Job
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
j, err = jobs.FromContext(ctx)
|
j, err = jobs.FromContext(ctx)
|
||||||
log.Println("got job id:", j.ID, "messsage:", j.Payload["message"])
|
log.Println("got job id:", j.ID, "messsage:", j.Payload["message"])
|
||||||
done <- true
|
done <- true
|
||||||
|
|
@ -38,7 +36,6 @@ func main() {
|
||||||
log.Println("error listening to queue", err)
|
log.Println("error listening to queue", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a job that will execute 1 hour from now
|
|
||||||
jobID, err := nq.Enqueue(ctx, &jobs.Job{
|
jobID, err := nq.Enqueue(ctx, &jobs.Job{
|
||||||
Queue: queue,
|
Queue: queue,
|
||||||
Payload: map[string]interface{}{
|
Payload: map[string]interface{}{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue