1234567891011121314151617181920212223242526 |
- # coding:utf-8
- from a2s.a2s_server import watch
- import multiprocessing
- import random
- import time
- @watch
- def run(data: bytes, *args, **kwargs):
- t=random.randint(4,30)
- time.sleep(t)
- return data
- def worker():
- run(nats_host="192.168.3.240", nats_port=19090, subject="test2img", queue="main")
- def add_picture_process():
- new_process = multiprocessing.Process(target=worker)
- new_process.start()
- return new_process
- if __name__ == '__main__':
- worker()
|