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