Skip to content

Commit

Permalink
Refactor mq_from_client to client_to_core to be more precise
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 13, 2023
1 parent a610cf4 commit e889581
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions neon_speech/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def handle_get_stt(self, message: Message):
sent_time = message.context.get("timing", {}).get("client_sent",
received_time)
if received_time != sent_time:
message.context['timing']['mq_from_client'] = \
message.context['timing']['client_to_core'] = \
received_time - sent_time
self.bus.emit(message.reply(ident,
data={"parser_data": parser_data,
Expand Down Expand Up @@ -386,7 +386,7 @@ def build_context(msg: Message):
sent_time = message.context.get("timing", {}).get("client_sent",
received_time)
if received_time != sent_time:
message.context['timing']['mq_from_client'] = \
message.context['timing']['client_to_core'] = \
received_time - sent_time
ident = message.context.get("ident") or "neon.audio_input.response"
LOG.info(f"Handling audio input: {ident}")
Expand Down
6 changes: 3 additions & 3 deletions tests/api_method_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_get_stt_valid_file(self):
self.assertIn("stop", stt_resp.data.get("transcripts"))
self.assertEqual(stt_resp.context['timing']['client_sent'],
context['timing']['client_sent'], stt_resp.context)
self.assertIsInstance(stt_resp.context['timing']['mq_from_client'],
self.assertIsInstance(stt_resp.context['timing']['client_to_core'],
float, stt_resp.context)

def test_get_stt_valid_contents(self):
Expand Down Expand Up @@ -187,7 +187,7 @@ def test_audio_input_valid(self):
self.assertEqual(context[key], stt_resp.context[key])
self.assertIsInstance(stt_resp.data.get("skills_recv"), bool,
stt_resp.serialize())
self.assertIsInstance(stt_resp.context['timing']['mq_from_client'],
self.assertIsInstance(stt_resp.context['timing']['client_to_core'],
float, stt_resp.context)

handle_utterance.assert_called_once()
Expand All @@ -201,7 +201,7 @@ def test_audio_input_valid(self):
self.assertIn("stop", message.data["utterances"],
message.data.get("utterances"))
self.assertIsInstance(message.context["timing"], dict)
self.assertIsInstance(message.context['timing']['mq_from_client'],
self.assertIsInstance(message.context['timing']['client_to_core'],
float, message.context)
self.assertIsInstance(message.context['timing']['transcribed'], float,
message.context)
Expand Down

0 comments on commit e889581

Please sign in to comment.