fix
This commit is contained in:
parent
bc9c8ad85d
commit
4d2e0198f3
@ -71,7 +71,7 @@ func Take(queue string) (*Task, error) {
|
||||
"taken_at": now,
|
||||
"attempts": task.Attempts + 1,
|
||||
"available_from": now.Add(
|
||||
time.Duration(task.SecondsToExecute) * time.Second,
|
||||
time.Duration(task.SecondsToExecute+task.Attempts) * time.Second,
|
||||
),
|
||||
},
|
||||
},
|
||||
@ -91,7 +91,7 @@ func findTask(queue string, now time.Time) (*Task, error) {
|
||||
"queue": queue,
|
||||
"available_from": bson.M{"$lte": now},
|
||||
},
|
||||
options.Find().SetLimit(1),
|
||||
options.Find().SetSort(bson.D{{Key: "available_from", Value: 1}}).SetLimit(1),
|
||||
)
|
||||
if err != nil {
|
||||
println("Error find")
|
||||
|
Loading…
Reference in New Issue
Block a user