You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
558 B
31 lines
558 B
package changes
|
|
|
|
import (
|
|
"log"
|
|
"sync"
|
|
"time"
|
|
|
|
"git.aiterp.net/rpdata/api/internal/store"
|
|
"github.com/globalsign/mgo"
|
|
)
|
|
|
|
var collection *mgo.Collection
|
|
var submitMutex sync.Mutex
|
|
|
|
func init() {
|
|
store.HandleInit(func(db *mgo.Database) {
|
|
collection = db.C("common.changes")
|
|
|
|
collection.EnsureIndexKey("date")
|
|
collection.EnsureIndexKey("author")
|
|
|
|
err := collection.EnsureIndex(mgo.Index{
|
|
Name: "expiry",
|
|
Key: []string{"date"},
|
|
ExpireAfter: time.Hour * 2400, // 100 days
|
|
})
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
})
|
|
}
|