19 lines
475 B
Go
19 lines
475 B
Go
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
|
|
}
|
|
}
|