Actually use FilterByLastSeen()
This commit is contained in:
parent
eca858c01e
commit
8c8b7c4f9b
|
@ -75,7 +75,7 @@ func readMapFromDisk(persistenceFilePath string, logger *log.Logger) map[EventKe
|
||||||
data := make([]PersistenceRecord, 0)
|
data := make([]PersistenceRecord, 0)
|
||||||
err = dec.Decode(&data)
|
err = dec.Decode(&data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Println("LastSeenFilter: Error reading persistence file", persistenceFilePath, "from disk:", err, ". Discarding and starting over.")
|
logger.Println("Error reading persistence file", persistenceFilePath, "from disk:", err, ". Discarding and starting over.")
|
||||||
return lastSeen
|
return lastSeen
|
||||||
}
|
}
|
||||||
for _, readData := range data {
|
for _, readData := range data {
|
||||||
|
|
2
main.go
2
main.go
|
@ -98,7 +98,7 @@ func main() {
|
||||||
|
|
||||||
tgSender := TgSender{bot}
|
tgSender := TgSender{bot}
|
||||||
go tgSenderWorker(tgEvents, tgSender, &wg, sleeper, log.New(os.Stderr, "TgSender", log.Lmicroseconds))
|
go tgSenderWorker(tgEvents, tgSender, &wg, sleeper, log.New(os.Stderr, "TgSender", log.Lmicroseconds))
|
||||||
for e := range s.Events {
|
for e := range FilterByLastSeen(s.Events, "hs_wro_last_seen.bin", log.New(os.Stderr, "FilterByLastSeen", log.Lmicroseconds)) {
|
||||||
logger.Print("Received change from SATEL: ", e)
|
logger.Print("Received change from SATEL: ", e)
|
||||||
sendTgMessage(tgEvents, fmt.Sprint("Change from SATEL: type:", e.Type, ", index:", e.Index, ", value:", e.Value), chatIds)
|
sendTgMessage(tgEvents, fmt.Sprint("Change from SATEL: type:", e.Type, ", index:", e.Index, ", value:", e.Value), chatIds)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue