Commit 0549e555 authored by lixiaofang's avatar lixiaofang

add

parent 6a1d7980
...@@ -18,6 +18,9 @@ from linucb.utils.register_user_tag import RegisterUserTag ...@@ -18,6 +18,9 @@ from linucb.utils.register_user_tag import RegisterUserTag
from injection.data_sync.get_session import get_comments, click, login, reply from injection.data_sync.get_session import get_comments, click, login, reply
from injection.data_sync.get_session import host, user, passwd, db from injection.data_sync.get_session import host, user, passwd, db
exec_count_click = 0
exec_count = 0
@shared_task @shared_task
def write_to_es(es_type, pk_list, use_batch_query_set=False): def write_to_es(es_type, pk_list, use_batch_query_set=False):
...@@ -106,7 +109,7 @@ def sync_user_similar_score(): ...@@ -106,7 +109,7 @@ def sync_user_similar_score():
def auto_click(pk_list): def auto_click(pk_list):
logging.info("get--------auto_click--------------:%s" % pk_list) logging.info("get--------auto_click--------------:%s" % pk_list)
exec_count = 0 exec_count_click = 0
try: try:
now = datetime.datetime.now() now = datetime.datetime.now()
yes_time_str = now.strftime('%Y-%m-%d') yes_time_str = now.strftime('%Y-%m-%d')
...@@ -120,7 +123,6 @@ def auto_click(pk_list): ...@@ -120,7 +123,6 @@ def auto_click(pk_list):
topic_id_list = list(data) topic_id_list = list(data)
logging.info("Database version : %s " % topic_id_list) logging.info("Database version : %s " % topic_id_list)
pc.close() pc.close()
exec_count = 0
if topic_id_list: if topic_id_list:
try: try:
def fun_timer(): def fun_timer():
...@@ -129,17 +131,17 @@ def auto_click(pk_list): ...@@ -129,17 +131,17 @@ def auto_click(pk_list):
click(cookies, topic_id_list[0]) click(cookies, topic_id_list[0])
global timer global timer
global exec_count global exec_count_click
exec_count += 1 exec_count_click += 1
if exec_count == 1: if exec_count_click == 1:
logging.info("----------2-----------") logging.info("----------2-----------")
# sleep_time = random.randint(300, 540) # sleep_time = random.randint(300, 540)
sleep_time = 30 sleep_time = 30
timer = threading.Timer(sleep_time, fun_timer) timer = threading.Timer(sleep_time, fun_timer)
timer.start() timer.start()
if exec_count == 2: if exec_count_click == 2:
# sleep_time = random.randint(1000, 1900) # sleep_time = random.randint(1000, 1900)
logging.info("----------3-----------") logging.info("----------3-----------")
sleep_time = 50 sleep_time = 50
...@@ -176,7 +178,6 @@ def auto_reply(pk_list): ...@@ -176,7 +178,6 @@ def auto_reply(pk_list):
topic_id_list = list(data) topic_id_list = list(data)
logging.info("Database version : %s " % topic_id_list) logging.info("Database version : %s " % topic_id_list)
pc.close() pc.close()
exec_count = 0
if topic_id_list: if topic_id_list:
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment