Commit 077803c5 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

minor cleanup of data request parsing

parent b30a1414
......@@ -406,15 +406,20 @@ class DataStore(QtCore.QObject):
logger.debug("REQUEST: {} {}".format(trend, start_end))
assert trend in self.TREND_TYPES
self.last_trend = trend
now = gpsnow()
start, end = start_end
assert end > start
# FIXME: we really need to do something to put a check on the
# length of the request. It really should be based on the
# bytes being requested, but we don't know the sample rate a
# priori.
span = abs(end - start)
max_seconds = const.TREND_MAX_SECONDS[trend]
if abs(end - start) > max_seconds:
if span > max_seconds:
f"data request span too large (max span {max_seconds} seconds for {trend} trend)",
f"Requested span too large: {max_seconds} seconds max for {trend} trend",
......@@ -431,11 +436,14 @@ class DataStore(QtCore.QObject):
elif trend !=
# note we continue if online and trend is not changing
# expand range to ints
rstart = int(start)
rend = int(np.ceil(end))
now = gpsnow()
if rstart > now:
# self.signal_data_retrieve_done.emit("Requested start time in the future.")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment