aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2018-12-16 14:35:36 -0800
committerAdam Mathes <adam@trenchant.org>2018-12-16 14:35:36 -0800
commitcb3c8ef60ceff0501dd5c7fcee5a8871056fc39d (patch)
tree4d253e8ffbdd8391476660afa776fff09b3283bc
parent8903f360f58b7364c468d1a5a0afdd66774dc4da (diff)
downloadneko-cb3c8ef60ceff0501dd5c7fcee5a8871056fc39d.tar.gz
neko-cb3c8ef60ceff0501dd5c7fcee5a8871056fc39d.tar.bz2
neko-cb3c8ef60ceff0501dd5c7fcee5a8871056fc39d.zip
fix mem leak (maybe) in feed crawler, re-enable bg crawl
-rw-r--r--main.go4
-rw-r--r--models/feed/feed.go2
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)
}