mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-09 22:44:44 +00:00
implemented event delay with dummy listener,
event delay listener in data.py unimplemented
Former-commit-id: dea5f3a374
This commit is contained in:
parent
56d3a0adcd
commit
32ae4fd636
@ -185,4 +185,8 @@ def push_pit(apikey, competition, pit):
|
|||||||
|
|
||||||
for variable in pit:
|
for variable in pit:
|
||||||
|
|
||||||
push_team_pit_data(apikey, competition, variable, pit[variable])
|
push_team_pit_data(apikey, competition, variable, pit[variable])
|
||||||
|
|
||||||
|
def check_new_database_matches(client, competition):
|
||||||
|
|
||||||
|
return True
|
@ -158,7 +158,7 @@ import warnings
|
|||||||
import websockets
|
import websockets
|
||||||
|
|
||||||
from interface import splash, log, ERR, INF, stdout, stderr
|
from interface import splash, log, ERR, INF, stdout, stderr
|
||||||
from data import get_previous_time, set_current_time, load_match, push_match, load_pit, push_pit
|
from data import get_previous_time, set_current_time, load_match, push_match, load_pit, push_pit, check_new_database_matches
|
||||||
from processing import matchloop, metricloop, pitloop
|
from processing import matchloop, metricloop, pitloop
|
||||||
|
|
||||||
config_path = "config.json"
|
config_path = "config.json"
|
||||||
@ -207,7 +207,7 @@ sample_json = """{
|
|||||||
"attitude":true
|
"attitude":true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"even-delay":false,
|
"event-delay":false,
|
||||||
"loop-delay":60
|
"loop-delay":60
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
@ -383,11 +383,20 @@ def main(send, verbose = False, profile = False):
|
|||||||
set_current_time(client, current_time)
|
set_current_time(client, current_time)
|
||||||
send(stdout, INF, "finished all tests in " + str(time.time() - loop_start) + " seconds, looping")
|
send(stdout, INF, "finished all tests in " + str(time.time() - loop_start) + " seconds, looping")
|
||||||
|
|
||||||
loop_delay = float(config["loop-delay"])
|
event_delay = config["event-delay"]
|
||||||
remaining_time = loop_delay - (time.time() - loop_start)
|
if event_delay:
|
||||||
if remaining_time > 0:
|
send(stdout, INF, "loop delayed until database returns new matches")
|
||||||
send(stdout, INF, "loop delayed by " + str(remaining_time) + " seconds")
|
new_match = False
|
||||||
time.sleep(remaining_time)
|
while not new_match:
|
||||||
|
time.sleep(1)
|
||||||
|
new_match = check_new_database_matches(client, competition)
|
||||||
|
send(stdout, INF, "database returned new matches")
|
||||||
|
else:
|
||||||
|
loop_delay = float(config["loop-delay"])
|
||||||
|
remaining_time = loop_delay - (time.time() - loop_start)
|
||||||
|
if remaining_time > 0:
|
||||||
|
send(stdout, INF, "loop delayed by " + str(remaining_time) + " seconds")
|
||||||
|
time.sleep(remaining_time)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
send(stdout, INF, "detected KeyboardInterrupt, killing threads")
|
send(stdout, INF, "detected KeyboardInterrupt, killing threads")
|
||||||
|
Loading…
Reference in New Issue
Block a user