From 16f0b33d7ce015ef51a1f231edc5cb9b137b5255 Mon Sep 17 00:00:00 2001 From: Terry Liao <jinliang@student.unimelb.edu.au> Date: Mon, 13 May 2019 19:46:57 +1000 Subject: [PATCH] add waiting strategy for tweet_search --- tweet_havester/tweepy_search.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tweet_havester/tweepy_search.py b/tweet_havester/tweepy_search.py index b89fdd7..3f5662f 100644 --- a/tweet_havester/tweepy_search.py +++ b/tweet_havester/tweepy_search.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import json import os +import time import couchdb import tweepy from tweepy import OAuthHandler @@ -81,8 +82,13 @@ def run(server_path): count = 0 ids = list() a = TweetSearchHavester(couch) - while True: - print("start a new round") + while True: + ids = list() + # if user id pool less than 40, won't start for query search + if(len(db) < 40): + time.wait(100) + continue + print("start a new round on search") for id in db: data = db[id] if(not data['isSearched']): -- GitLab