Sfoglia il codice sorgente

线程池异步推送图片

locky 1 anno fa
parent
commit
af4ddbbc91
1 ha cambiato i file con 9 aggiunte e 2 eliminazioni
  1. 9 2
      Service/DevicePushService.py

+ 9 - 2
Service/DevicePushService.py

@@ -400,11 +400,18 @@ class DevicePushService:
                 else:
                     key = '{}/{}/{}_0.jpeg'.format(kwargs['uid'], kwargs['channel'], kwargs['n_time'])
                 # 开始异步推送图片
-                push_thread = threading.Thread(target=cls.async_send_picture_push, args=(
+                thread_pool = GlobalThreadPool()
+                thread_pool.submit(cls.async_send_picture_push, (
                     push_type, kwargs['aws_s3_client'], kwargs['bucket'], key,
                     kwargs['uid'], kwargs['appBundleId'], kwargs['token_val'], kwargs['event_type'], kwargs['n_time'],
                     push_kwargs['msg_title'], push_kwargs['msg_text'], kwargs['channel'], kwargs['storage_location']))
-                push_thread.start()
+
+                # push_thread = threading.Thread(target=cls.async_send_picture_push, args=(
+                #     push_type, kwargs['aws_s3_client'], kwargs['bucket'], key,
+                #     kwargs['uid'], kwargs['appBundleId'], kwargs['token_val'], kwargs['event_type'], kwargs['n_time'],
+                #     push_kwargs['msg_title'], push_kwargs['msg_text'], kwargs['channel'], kwargs['storage_location']))
+                # push_thread.start()
+
                 push_result = True
 
             # 不推图