liqian 1 ano atrás
pai
commit
602e61a216
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      ad_predict.py

+ 3 - 3
ad_predict.py

@@ -18,13 +18,13 @@ def thompson_process(creative_id):
     # 获取creative_id对应的Thompson参数
     st_time1 = time.time()
     thompson_param = redis_helper.get_data_from_redis(key_name=f"{config_.THOMPSON_PARAM_KEY_PREFIX}{creative_id}")
-    get_redis_time = int(time.time() - st_time1)
+    get_redis_time = int(time.time() - st_time1) * 1000
     thompson_time = {}
     if thompson_param is None or thompson_param == '':
         # 参数不存在,随机生成[0, 1)之间的浮点数
         st_time2 = time.time()
         score = random.random()
-        thompson_time['random'] = int(time.time() - st_time2)
+        thompson_time['random'] = int(time.time() - st_time2) * 1000
         random_flag = 'random'
     else:
         # 参数存在
@@ -39,7 +39,7 @@ def thompson_process(creative_id):
             # ad_idea_id 曝光数 < 100,随机生成[0, 1)之间的浮点数
             score = random.random()
             random_flag = 'random'
-        thompson_time['beta'] = int(time.time() - st_time3)
+        thompson_time['beta'] = int(time.time() - st_time3) * 1000
     thompson_res = [creative_id, score, thompson_param, random_flag]
     log_.info(f"get_redis_time: {get_redis_time}, thompson_time: {thompson_time}")
     return thompson_res