cari

Rumah  >  Soal Jawab  >  teks badan

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)
怪我咯怪我咯2777 hari yang lalu922

membalas semua(1)saya akan balas

  • 天蓬老师

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

    Semak sama ada getDataListFromBKY dipanggil sekali dalam modul lain? ?

    balas
    0
  • Batalbalas