fix ingest dir
This commit is contained in:
parent
6f18e75688
commit
260d2ec24b
@ -16,8 +16,6 @@ import (
|
||||
"pool-stats/models"
|
||||
)
|
||||
|
||||
const logsDir = "/home/pk/pro/pkstats/logs"
|
||||
|
||||
type Ingestor struct {
|
||||
db *clover.DB
|
||||
logPath string
|
||||
@ -38,7 +36,7 @@ func (this *Ingestor) WatchAndIngest() {
|
||||
}
|
||||
|
||||
func (this *Ingestor) ingestClosedBlocks() {
|
||||
entries, err := os.ReadDir(logsDir)
|
||||
entries, err := os.ReadDir(this.logPath)
|
||||
if err != nil {
|
||||
log.Println("Error reading logsDir:", err)
|
||||
return
|
||||
@ -63,8 +61,8 @@ func (this *Ingestor) ingestClosedBlocks() {
|
||||
|
||||
// Ingest all except last (current block dir)
|
||||
for _, dir := range blockDirs[:len(blockDirs)-1] {
|
||||
this.ingestBlockDir(this.db, filepath.Join(logsDir, dir.Name()))
|
||||
_ = os.RemoveAll(filepath.Join(logsDir, dir.Name()))
|
||||
this.ingestBlockDir(this.db, filepath.Join(this.logPath, dir.Name()))
|
||||
_ = os.RemoveAll(filepath.Join(this.logPath, dir.Name()))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user