Heim  >  Fragen und Antworten  >  Hauptteil

python bottle跑起来以后,定时执行的任务为什么每次都重复(多)执行一次?


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)
怪我咯怪我咯2763 Tage vor909

Antworte allen(1)Ich werde antworten

  • 天蓬老师

    天蓬老师2017-04-18 10:24:34

    检查getDataListFromBKY 是不是在另一个模块中调用了一次??

    Antwort
    0
  • StornierenAntwort