Skip to content
This repository was archived by the owner on Aug 30, 2020. It is now read-only.

Commit 5852e16

Browse files
author
Hongze Xia
committed
avoid printing empty entities
1 parent b6daffa commit 5852e16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gutils/tasks.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ import (
1616
var priceRegex, _ = regexp.Compile("\\d+\\.?\\d{0,}")
1717

1818
func processEntity(ent *models.Entity, pushClient *pushover.Client) {
19-
if ent.K == nil {
20-
return
21-
}
2219
// save the entity before returning
2320
defer func() {
2421
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(CancelWaitTime))
@@ -91,6 +88,9 @@ func Refresh(pushClient *pushover.Client, fetchLimit int) {
9188
log.Println("INFO: Refresh started")
9289
entities := FetchData(fetchLimit)
9390
for _, ent := range entities {
91+
if ent.K == nil {
92+
continue
93+
}
9494
log.Printf("INFO: processing [%s] XPATH (%s) at %s", ent.Name, ent.XPATH, ent.URL)
9595
processEntity(&ent, pushClient)
9696
}

0 commit comments

Comments
 (0)