|
@@ -2,6 +2,7 @@
|
|
|
import random
|
|
|
import time
|
|
|
import traceback
|
|
|
+import platform
|
|
|
|
|
|
# Press Shift+F10 to execute it or replace it with your code.
|
|
|
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
|
|
@@ -253,10 +254,6 @@ def schedule_thread_task():
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
- # 将要发送的消息
|
|
|
- testMsg = load_mock_msg('m3u8TsTask.json')
|
|
|
- testMsg = load_mock_msg('normalHtml.json')
|
|
|
-
|
|
|
# 开子线程 去监听消费消息
|
|
|
for i in range(8):
|
|
|
# 实例化的rabbbitmq对象
|
|
@@ -272,10 +269,16 @@ if __name__ == '__main__':
|
|
|
schedule_thread.start()
|
|
|
|
|
|
# 发消息
|
|
|
- spider_task_queue = connected_to_spider_mq()
|
|
|
+ # 将要发送的消息
|
|
|
+ sys_platform = platform.platform().lower()
|
|
|
+ if "windows" in sys_platform:
|
|
|
+ print("Windows")
|
|
|
+ testMsg = load_mock_msg('m3u8TsTask.json')
|
|
|
+ testMsg = load_mock_msg('normalHtml.json')
|
|
|
+ spider_task_queue = connected_to_spider_mq()
|
|
|
|
|
|
- for i in range(5):
|
|
|
- #spider_task_queue.publishMsg(json.dumps(testMsg, ensure_ascii=False), delay_ms=2000)
|
|
|
- print('生产者发送第 {} 个消息成功 '.format(i + 1))
|
|
|
+ for i in range(5):
|
|
|
+ #spider_task_queue.publishMsg(json.dumps(testMsg, ensure_ascii=False), delay_ms=2000)
|
|
|
+ print('生产者发送第 {} 个消息成功 '.format(i + 1))
|
|
|
print('\n -- 主程序不被阻塞,执行其它操作 --- \n')
|
|
|
time.sleep(10000)
|