mirror of https://github.com/ledisdb/ledisdb.git
adjust readonly check
This commit is contained in:
parent
10a367f978
commit
5196e211cc
|
@ -18,7 +18,7 @@ type batch struct {
|
|||
}
|
||||
|
||||
func (b *batch) Commit() error {
|
||||
if b.l.IsReadOnly() {
|
||||
if b.l.cfg.GetReadonly() {
|
||||
return ErrWriteInROnly
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,10 @@ func (l *Ledis) handleCommit(g commitDataGetter, c commiter) error {
|
|||
|
||||
var err error
|
||||
if l.r != nil {
|
||||
if b, _ := l.r.CommitIDBehind(); b {
|
||||
return ErrWriteInROnly
|
||||
}
|
||||
|
||||
var rl *rpl.Log
|
||||
if rl, err = l.r.Log(g.Data()); err != nil {
|
||||
log.Fatal("write wal error %s", err.Error())
|
||||
|
|
Loading…
Reference in New Issue