mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-01-08 21:43:01 -06:00
Use advanced scheduler by default
This commit is contained in:
parent
433ffe6a7b
commit
205ec17375
@ -7,6 +7,9 @@ if automaticImportUISP:
|
|||||||
from integrationUISP import importFromUISP
|
from integrationUISP import importFromUISP
|
||||||
if automaticImportSplynx:
|
if automaticImportSplynx:
|
||||||
from integrationSplynx import importFromSplynx
|
from integrationSplynx import importFromSplynx
|
||||||
|
from apscheduler.schedulers.background import BlockingScheduler
|
||||||
|
|
||||||
|
ads = BlockingScheduler()
|
||||||
|
|
||||||
def importFromCRM():
|
def importFromCRM():
|
||||||
if automaticImportUISP:
|
if automaticImportUISP:
|
||||||
@ -20,6 +23,16 @@ def importFromCRM():
|
|||||||
except:
|
except:
|
||||||
print("Failed to import from Splynx")
|
print("Failed to import from Splynx")
|
||||||
|
|
||||||
|
def graphHandler():
|
||||||
|
try:
|
||||||
|
refreshBandwidthGraphs()
|
||||||
|
except:
|
||||||
|
print("Failed to update bandwidth graphs")
|
||||||
|
try:
|
||||||
|
refreshLatencyGraphs()
|
||||||
|
except:
|
||||||
|
print("Failed to update latency graphs")
|
||||||
|
|
||||||
def importAndShapeFullReload():
|
def importAndShapeFullReload():
|
||||||
importFromCRM()
|
importFromCRM()
|
||||||
refreshShapers()
|
refreshShapers()
|
||||||
@ -28,35 +41,12 @@ def importAndShapePartialReload():
|
|||||||
importFromCRM()
|
importFromCRM()
|
||||||
refreshShapersUpdateOnly()
|
refreshShapersUpdateOnly()
|
||||||
|
|
||||||
def graph():
|
|
||||||
time.sleep(10)
|
|
||||||
try:
|
|
||||||
refreshBandwidthGraphs()
|
|
||||||
except:
|
|
||||||
print("Failed to run refreshBandwidthGraphs()")
|
|
||||||
time.sleep(10)
|
|
||||||
try:
|
|
||||||
refreshBandwidthGraphs()
|
|
||||||
except:
|
|
||||||
print("Failed to run refreshBandwidthGraphs()")
|
|
||||||
time.sleep(10)
|
|
||||||
try:
|
|
||||||
refreshBandwidthGraphs()
|
|
||||||
except:
|
|
||||||
print("Failed to run refreshBandwidthGraphs()")
|
|
||||||
time.sleep(1)
|
|
||||||
try:
|
|
||||||
refreshLatencyGraphs()
|
|
||||||
except:
|
|
||||||
print("Failed to run refreshLatencyGraphs()")
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
importAndShapeFullReload()
|
importAndShapeFullReload()
|
||||||
while True:
|
|
||||||
finish_time = datetime.datetime.now() + datetime.timedelta(minutes=30)
|
ads.add_job(importAndShapePartialReload, 'interval', minutes=30)
|
||||||
while datetime.datetime.now() < finish_time:
|
|
||||||
if influxDBEnabled:
|
if influxDBEnabled:
|
||||||
graph()
|
ads.add_job(graphHandler, 'interval', seconds=10)
|
||||||
else:
|
|
||||||
time.sleep(1)
|
ads.start()
|
||||||
importAndShapePartialReload()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user