mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-09 22:44:44 +00:00
Merge pull request #17 from titanscouting/event-listener
Pull changes from event-listener to superscript-v1
Former-commit-id: 82b62924f6
This commit is contained in:
commit
31423d04d8
@ -194,4 +194,8 @@ def push_pit(client, competition, pit):
|
||||
|
||||
for variable in pit:
|
||||
|
||||
push_team_pit_data(client, competition, variable, pit[variable])
|
||||
push_team_pit_data(apikey, competition, variable, pit[variable])
|
||||
|
||||
def check_new_database_matches(client, competition):
|
||||
|
||||
return True
|
@ -164,7 +164,7 @@ import warnings
|
||||
import websockets
|
||||
|
||||
from interface import splash, log, ERR, INF, stdout, stderr
|
||||
from data import get_previous_time, pull_new_tba_matches, set_current_time, load_match, push_match, load_pit, push_pit, get_database_config, set_database_config
|
||||
from data import get_previous_time, pull_new_tba_matches, set_current_time, load_match, push_match, load_pit, push_pit, get_database_config, set_database_config, check_new_database_matches
|
||||
from processing import matchloop, metricloop, pitloop
|
||||
|
||||
config_path = "config.json"
|
||||
@ -216,9 +216,8 @@ sample_json = """{
|
||||
"strategic-focus":true,
|
||||
"climb-mechanism":true,
|
||||
"attitude":true
|
||||
}
|
||||
},
|
||||
"even-delay":false,
|
||||
"event-delay":false,
|
||||
"loop-delay":60
|
||||
}
|
||||
}"""
|
||||
@ -315,7 +314,16 @@ def main(send, verbose = False, profile = False, debug = False):
|
||||
if profile:
|
||||
return # return instead of break to avoid sys.exit
|
||||
|
||||
loop_delay = float(config["variable"]["loop-delay"])
|
||||
event_delay = config["event-delay"]
|
||||
if event_delay:
|
||||
send(stdout, INF, "loop delayed until database returns new matches")
|
||||
new_match = False
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user