manual trigger GC in import and export
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/dgraph-io/badger/v4"
|
||||
|
||||
@@ -224,6 +225,7 @@ func (r *T) BlanketDownload(c context.T, w io.Writer) (counter int, err error) {
|
||||
counter++
|
||||
if counter%1000 == 0 && counter > 0 {
|
||||
log.I.F("%d events exported", counter)
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
@@ -3,7 +3,7 @@ package ratel
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"time"
|
||||
"runtime/debug"
|
||||
|
||||
"realy.lol/chk"
|
||||
"realy.lol/event"
|
||||
@@ -36,9 +36,9 @@ func (r *T) Import(rr io.Reader) {
|
||||
b = nil
|
||||
ev = nil
|
||||
count++
|
||||
if count%1000 == 0 {
|
||||
if count%100 == 0 {
|
||||
log.I.F("received %d events", count)
|
||||
time.Sleep(time.Second)
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
}
|
||||
log.I.F("read %d bytes and saved %d events", total, count)
|
||||
|
||||
Reference in New Issue
Block a user