use Context to send cancelation signals to groutines

This commit is contained in:
mind1949 2020-06-12 21:31:08 +08:00
parent bf3225765d
commit 5048018d48
5 changed files with 42 additions and 8 deletions

View file

@ -45,7 +45,7 @@ import (
)
func main() {
for tweet := range twitterscraper.SearchTweets("twitter scraper data -filter:retweets", 50) {
for tweet := range twitterscraper.SearchTweets(context.Background(), "twitter scraper data -filter:retweets", 50) {
if tweet.Error != nil {
panic(tweet.Error)
}