Skip to content

Commit ad8845c

Browse files
Workaround for bad header: Simon Young <syoung@bamfunds.com>
Snap the publish time at the start of the node: Simon Young <syoung@bamfunds.com> Use wallclock time for perspective history: Simon Young <syoung@bamfunds.com> Signed-off-by: Alexander Balabin <abalabin@bamfunds.com>
1 parent 8566afe commit ad8845c

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

hgraph/adaptors/perspective/_perspetive_publish.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def _publish_table_from_tsd(
7676
to be tuples in which case the index_col_name is expected to be a comma separated list (no spaces) of the key names
7777
in order. index_col_name can also include names of columns from the value in case of Frame value type.
7878
"""
79+
now = ec.now
7980
data = None
8081
if state.multi_row:
8182
for k in ts.removed_keys():
@@ -116,10 +117,10 @@ def _publish_table_from_tsd(
116117
data = {**data, **state.create_index(data)}
117118
if history is not None:
118119
if state.sample_row:
119-
sample = {**state.sample_row(v), **data, "time": ec.evaluation_time}
120+
sample = {**state.sample_row(v), **data, "time": now}
120121
state.history.append(sample)
121122
else:
122-
state.history.append({**data, "time": ec.evaluation_time})
123+
state.history.append({**data, "time": now})
123124

124125
if state.map_index:
125126
with state.index_to_id_lock:

hgraph/adaptors/sql/sql_adaptor_raw.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def run_query(connection: SqlAdaptorConnection, id: int, query: str, queue):
8787
queue(tick)
8888
except Exception as e:
8989
logger.error(f"Query {id} on {path} failed: {query}")
90-
time_taken = time_str((time.perf_counter_ns() - start) / 1_000_000_000)
91-
logger.exception(f"Query failed after {time_taken}")
90+
time_taken = (time.perf_counter_ns() - start) / 1_000_000_000
91+
logger.exception(f"Query failed after {time_taken}s")
9292
error = {id: {"status": StreamStatus.ERROR, "status_msg": str(e)}}
9393
queue(error)
9494

@@ -216,13 +216,13 @@ def run_query(connection: SqlAdaptorConnection, id: int, query: str, queue):
216216
logger.info(f"Executing query {id} on {path}:\n{query}")
217217
start = time.perf_counter_ns()
218218
r = connection.read_database(query)
219-
time_taken = time_str((time.perf_counter_ns() - start) / 1_000_000_000)
220-
logger.info(f"Finished executing query {id} in {time_taken}")
219+
time_taken = (time.perf_counter_ns() - start) / 1_000_000_000
220+
logger.info(f"Finished executing query {id} in {time_taken}s")
221221
tick = {id: {"status": StreamStatus.OK, "status_msg": "", "timestamp": datetime.now(UTC)}}
222222
queue(tick)
223223
except Exception as e:
224224
logger.error(f"Query {id} on {path} failed: {query}")
225-
time_taken = time_str((time.perf_counter_ns() - start) / 1_000_000_000)
225+
time_taken = (time.perf_counter_ns() - start) / 1_000_000_000
226226
logger.exception(f"Query failed after {time_taken}")
227227
error = {id: {"status": StreamStatus.ERROR, "status_msg": str(e)}}
228228
queue(error)

hgraph/adaptors/tornado/http_client_adaptor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ async def handle_auth_win(response, request, client):
124124
final = response2.headers.get("WWW-Authenticate")
125125
if final is not None:
126126
try:
127-
challenge = [v[len(scheme) + 1 :] for val in final.split(",") if scheme in (v := val.strip())]
127+
if scheme in final:
128+
challenge = [v[len(scheme) + 1 :] for val in final.split(",") if scheme in (v := val.strip())]
129+
else:
130+
challenge = [val.strip() for val in final.split(",")]
128131
if len(challenge) > 1:
129132
raise HTTPError(401, f"Received more than one {scheme} challenge from server")
130133

0 commit comments

Comments
 (0)