Reversing idle list and fixing insert/upsert

This commit is contained in:
Chris Sexton 2013-01-28 13:39:21 -05:00
parent 290d687be4
commit 0fc2f81f17
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ func (ie idleEntries) Len() int {
}
func (ie idleEntries) Less(i, j int) bool {
return ie[i].LastSeen.After(ie[j].LastSeen)
return ie[i].LastSeen.Before(ie[j].LastSeen)
}
func (ie idleEntries) Swap(i, j int) {
@ -96,7 +96,7 @@ func (p *DowntimePlugin) record(user string) {
p.Coll.Find(bson.M{"nick": user}).One(&entry)
if entry.Nick != user {
// insert a new entry
p.Coll.Insert(idleEntry{
p.Coll.Upsert(bson.M{"nick": user}, idleEntry{
Nick: user,
LastSeen: time.Now(),
})