mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-01-06 20:53: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
|
||||
if automaticImportSplynx:
|
||||
from integrationSplynx import importFromSplynx
|
||||
from apscheduler.schedulers.background import BlockingScheduler
|
||||
|
||||
ads = BlockingScheduler()
|
||||
|
||||
def importFromCRM():
|
||||
if automaticImportUISP:
|
||||
@ -20,6 +23,16 @@ def importFromCRM():
|
||||
except:
|
||||
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():
|
||||
importFromCRM()
|
||||
refreshShapers()
|
||||
@ -28,35 +41,12 @@ def importAndShapePartialReload():
|
||||
importFromCRM()
|
||||
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__':
|
||||
importAndShapeFullReload()
|
||||
while True:
|
||||
finish_time = datetime.datetime.now() + datetime.timedelta(minutes=30)
|
||||
while datetime.datetime.now() < finish_time:
|
||||
if influxDBEnabled:
|
||||
graph()
|
||||
else:
|
||||
time.sleep(1)
|
||||
importAndShapePartialReload()
|
||||
|
||||
ads.add_job(importAndShapePartialReload, 'interval', minutes=30)
|
||||
|
||||
if influxDBEnabled:
|
||||
ads.add_job(graphHandler, 'interval', seconds=10)
|
||||
|
||||
ads.start()
|
||||
|
Loading…
Reference in New Issue
Block a user