mirror of https://github.com/ledisdb/ledisdb.git
Merge branch 'copy-bugfix' into develop
This commit is contained in:
parent
69aaba8509
commit
026a72b58e
|
@ -21,7 +21,7 @@ func line(prompt string) (string, error) {
|
||||||
defer C.free(unsafe.Pointer(resultCString))
|
defer C.free(unsafe.Pointer(resultCString))
|
||||||
|
|
||||||
if resultCString == nil {
|
if resultCString == nil {
|
||||||
return "", errors.New("quited by a signal")
|
return "", errors.New("exiting due to signal")
|
||||||
}
|
}
|
||||||
|
|
||||||
result := C.GoString(resultCString)
|
result := C.GoString(resultCString)
|
||||||
|
|
|
@ -196,14 +196,15 @@ func (s *FileStore) storeLog(l *Log) error {
|
||||||
func (s *FileStore) PurgeExpired(n int64) error {
|
func (s *FileStore) PurgeExpired(n int64) error {
|
||||||
s.rm.Lock()
|
s.rm.Lock()
|
||||||
|
|
||||||
purges := []*tableReader{}
|
var purges []*tableReader
|
||||||
|
|
||||||
t := uint32(time.Now().Unix() - int64(n))
|
t := uint32(time.Now().Unix() - int64(n))
|
||||||
|
|
||||||
for i, r := range s.rs {
|
for i, r := range s.rs {
|
||||||
if r.lastTime > t {
|
if r.lastTime > t {
|
||||||
purges = s.rs[0:i]
|
purges = append([]*tableReader{}, s.rs[0:i]...)
|
||||||
s.rs = s.rs[i:]
|
n := copy(s.rs, s.rs[i:])
|
||||||
|
s.rs = s.rs[0:n]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,8 +137,7 @@ func (s *snapshotStore) purge(create bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if num > 0 {
|
if num > 0 {
|
||||||
names = s.names[0:num]
|
names = append([]string{}, s.names[0:num]...)
|
||||||
|
|
||||||
n := copy(s.names, s.names[num:])
|
n := copy(s.names, s.names[num:])
|
||||||
s.names = s.names[0:n]
|
s.names = s.names[0:n]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue