python bottle跑起来以后,定时执行的任务为什么每次都重复(多)执行一次?
怪我咯
怪我咯 2017-04-18 10:22:34
0
1
948
  • 方法定时器里面的方法getDataListFromBKY,在服务器跑起来以后每次都执行两次,如果单独放在一个.py文件里面执行就执行一次.这是哪里出错了呢? 希望大神解答一下


sched = BackgroundScheduler()
sched.add_job(getDataListFromBKY, 'interval', seconds=15) # 采集时间间隔
sched.start()

@app.route('/', method='GET')
def query_data():
    for key, value in request.params.items():
        if key == 'fun' and value == 'query':
            print(key + ' : ' + value)
            dic = query_content()
            print(dic)
            return dic

app.run(host='localhost',port=8080, debug=True,reloader=True, server='gunicorn', workers=4)
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
Peter_Zhu

Check if getDataListFromBKY is called once in another module? ?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template