def run(self):
        time_now = int(time.time())
        before_last_vist_time = 10 - time_now

        queue = Queue.Queue()
        threads = []

        i = 0

        sql = "SELECT LINK_ID FROM TOPIC WHERE LAST_VISIT < %s ORDER BY LAST_VISIT"
        self.cursor.execute(sql, (before_last_vist_time,))
        results = self.cursor.fetchall()
        
        for row in results:
            link_id = str(row[0])

            queue.put([link_id, i])
            i = i + 1

        for i in range(self.topic_thread_amount):
            threads.append(UpdateOneTopic(queue))

        for i in range(self.topic_thread_amount):
            threads[i].start()

        for i in range(self.topic_thread_amount):
            threads[i].join()

        self.db.close()

        print 'All task done'
dataset/ETHPy150Open MorganZhang100/zhihu-spider/topic.py/UpdateTopics.run/swapped operands of `-`