搜尋

首頁  >  問答  >  主體

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)
怪我咯怪我咯2862 天前971

全部回覆(1)我來回復

  • 天蓬老师

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

    檢查getDataListFromBKY 是不是在另一個模組中呼叫了一次? ?

    回覆
    0
  • 取消回覆