aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2018-07-07 09:01:54 -0700
committerAdam Mathes <adam@trenchant.org>2018-07-07 09:01:54 -0700
commit16a05c8ddd5b9c81d8f7e671504b892e5d353913 (patch)
tree57a865c404eb9c4a0322fa1cb705cd4edcbe3cf0
parentcdc1f64031af949874fed73e1d51247dd4226660 (diff)
downloadneko-16a05c8ddd5b9c81d8f7e671504b892e5d353913.tar.gz
neko-16a05c8ddd5b9c81d8f7e671504b892e5d353913.tar.bz2
neko-16a05c8ddd5b9c81d8f7e671504b892e5d353913.zip
simpler background crawler attempt #2
-rw-r--r--main.go16
1 files changed, 2 insertions, 14 deletions
diff --git a/main.go b/main.go
index 9e5b180..b55cd2b 100644
--- a/main.go
+++ b/main.go
@@ -74,20 +74,8 @@ func main() {
}
func backgroundCrawl(minutes int) {
- if minutes < 1 {
- return
- }
- ticker := time.NewTicker(time.Minute * time.Duration(minutes))
- defer ticker.Stop()
- done := make(chan bool)
for {
- select {
- case <-done:
- fmt.Println("done")
- return
- case t := <-ticker.C:
- vlog.Printf("starting crawl at %s\n", t)
- crawler.Crawl()
- }
+ time.Sleep(time.Minute * time.Duration(minutes))
+ crawler.Crawl()
}
}