1
0
Fork 0

Actually use FilterByLastSeen()

This commit is contained in:
Michał Rudowicz 2024-02-15 20:20:56 +01:00
parent eca858c01e
commit 8c8b7c4f9b
2 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,7 @@ func readMapFromDisk(persistenceFilePath string, logger *log.Logger) map[EventKe
data := make([]PersistenceRecord, 0)
err = dec.Decode(&data)
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
}
for _, readData := range data {

View File

@ -98,7 +98,7 @@ func main() {
tgSender := TgSender{bot}
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)
sendTgMessage(tgEvents, fmt.Sprint("Change from SATEL: type:", e.Type, ", index:", e.Index, ", value:", e.Value), chatIds)
}