26 lines
404 B
Go
26 lines
404 B
Go
package db
|
|
|
|
import (
|
|
"fmt"
|
|
"th7/ports"
|
|
"time"
|
|
)
|
|
|
|
func startLoggingProcess(db ports.DBPort, core ports.CorePort, dur time.Duration) {
|
|
|
|
// wait 10 seconds to not log start up values that can be noisy
|
|
time.Sleep(10 * time.Second)
|
|
|
|
for {
|
|
|
|
val := core.GetChannels()
|
|
|
|
err := db.Save(val)
|
|
if err != nil {
|
|
fmt.Printf("Error encountered while saving values: %v\n", err)
|
|
}
|
|
|
|
time.Sleep(dur)
|
|
}
|
|
}
|