|
|
|
@ -13,6 +13,7 @@ import (
|
|
|
|
|
"forge.chapril.org/losyme/util" |
|
|
|
|
"go.mongodb.org/mongo-driver/bson" |
|
|
|
|
"go.mongodb.org/mongo-driver/mongo" |
|
|
|
|
"go.mongodb.org/mongo-driver/mongo/options" |
|
|
|
|
|
|
|
|
|
"forge.chapril.org/dune/dune/internal/storage" |
|
|
|
|
) |
|
|
|
@ -67,6 +68,13 @@ func (ms *mongoStorage) NextJob(namespace string, fn storage.SelectNextJob) (*jw
|
|
|
|
|
{"status": jw.StatusPending}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
options.Find().SetSort( |
|
|
|
|
[]bson.M{ |
|
|
|
|
{"priority": 1}, |
|
|
|
|
{"weight": -1}, |
|
|
|
|
{"time_reference": -1}, |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|