| 
					
				 | 
			
			
				@@ -5,7 +5,7 @@ import json 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import time 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import traceback 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import ast 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-from gevent import monkey 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+from gevent import monkey, pool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 monkey.patch_all() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from flask import Flask, request 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -16,6 +16,7 @@ from ad_predict import get_creative_id_with_thompson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 app = Flask(__name__) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 log_ = Log() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 config_ = set_config() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+gevent_pool = pool.Pool(100) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # log_.info(f"server start...") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -32,7 +33,7 @@ def get_creative_id(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         request_data = json.loads(request.get_data()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mid = request_data.get('mid') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         creative_id_list = request_data.get('creativeIdList') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        thompson_result = get_creative_id_with_thompson(mid=mid, creative_id_list=creative_id_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        thompson_result = get_creative_id_with_thompson(mid=mid, creative_id_list=creative_id_list, gevent_pool=gevent_pool) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         result = {'code': 200, 'message': 'success', 'data': {'mid': mid, 'creativeId': thompson_result['creative_id']}} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log_message = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             'requestUri': '/ad/predict/getCreativeId', 
			 |