From cb3c8ef60ceff0501dd5c7fcee5a8871056fc39d Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Sun, 16 Dec 2018 14:35:36 -0800 Subject: fix mem leak (maybe) in feed crawler, re-enable bg crawl --- main.go | 4 ++-- models/feed/feed.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 29888b2..d121deb 100644 --- a/main.go +++ b/main.go @@ -45,7 +45,6 @@ func main() { flag.Usage() return } - // reads config if present and sets defaults config.Init(configFile) @@ -89,7 +88,7 @@ func main() { return } - // go backgroundCrawl(config.Config.CrawlMinutes) + go backgroundCrawl(config.Config.CrawlMinutes) vlog.Printf("starting web server at 127.0.0.1:%d\n", config.Config.Port) web.Serve() @@ -99,6 +98,7 @@ func backgroundCrawl(minutes int) { if minutes < 1 { return } + vlog.Printf("starting background crawl every %d minutes\n", minutes) for { time.Sleep(time.Minute * time.Duration(minutes)) crawler.Crawl() diff --git a/models/feed/feed.go b/models/feed/feed.go index ce7aafe..e2730c7 100644 --- a/models/feed/feed.go +++ b/models/feed/feed.go @@ -79,7 +79,7 @@ func (f *Feed) Update() { return } - models.DB.Query(`UPDATE feed + _, _ = models.DB.Exec(`UPDATE feed SET title=?, url=?, web_url=?, category=? WHERE id=?`, f.Title, f.Url, f.WebUrl, f.Category, f.Id) } -- cgit v1.2.3