clessy-ng/modules/remind/data.go

20 lines
475 B
Go
Raw Permalink Normal View History

package remind
import (
"github.com/cockroachdb/pebble"
jsoniter "github.com/json-iterator/go"
"log"
)
func (m *Module) save() {
byt, err := jsoniter.ConfigFastest.Marshal(pending.Copy())
if err != nil {
log.Println("[remind] WARN: Could not encode reminders: " + err.Error())
}
err = m.kv.Set([]byte(reminderKey), byt, &pebble.WriteOptions{Sync: true})
if err != nil {
log.Println("[remind] WARN: Could not save reminders to db: " + err.Error())
return
}
}