我正在编写一个网站Flask
,将其与uwsgi + nginx
. 需要定期向mqtt
broker发送消息;为此,uwsgidecorators
选择了后台任务执行模块。该模块提供了@timer(seconds)
定期启动任务的装饰器。但是问题出现了如何中断这个任务的执行甚至杀死它?示例任务:
@timer(10, target='spooler')
def ten_seconds_in_the_spooler(mqtt, topic_req_res, msg, qos_req):
mqtt.publish(topic_req_res, msg, qos_req)
谢谢!