fix(signalr): use hub to send packet to trace packet
This commit is contained in:
@@ -265,12 +265,13 @@ class Hub[TState: UserState]:
|
|||||||
logger.exception(f"Error invoking method {packet.target} for client {client.connection_id}")
|
logger.exception(f"Error invoking method {packet.target} for client {client.connection_id}")
|
||||||
error = "Unknown error occured in server"
|
error = "Unknown error occured in server"
|
||||||
if packet.invocation_id is not None:
|
if packet.invocation_id is not None:
|
||||||
await client.send_packet(
|
await self.send_packet(
|
||||||
|
client,
|
||||||
CompletionPacket(
|
CompletionPacket(
|
||||||
invocation_id=packet.invocation_id,
|
invocation_id=packet.invocation_id,
|
||||||
error=error,
|
error=error,
|
||||||
result=result,
|
result=result,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
elif isinstance(packet, CompletionPacket):
|
elif isinstance(packet, CompletionPacket):
|
||||||
client._store.add_result(packet.invocation_id, packet.result, packet.error)
|
client._store.add_result(packet.invocation_id, packet.result, packet.error)
|
||||||
@@ -289,14 +290,15 @@ class Hub[TState: UserState]:
|
|||||||
|
|
||||||
async def call(self, client: Client, method: str, *args: Any) -> Any:
|
async def call(self, client: Client, method: str, *args: Any) -> Any:
|
||||||
invocation_id = client._store.get_invocation_id()
|
invocation_id = client._store.get_invocation_id()
|
||||||
await client.send_packet(
|
await self.send_packet(
|
||||||
|
client,
|
||||||
InvocationPacket(
|
InvocationPacket(
|
||||||
header={},
|
header={},
|
||||||
invocation_id=invocation_id,
|
invocation_id=invocation_id,
|
||||||
target=method,
|
target=method,
|
||||||
arguments=list(args),
|
arguments=list(args),
|
||||||
stream_ids=None,
|
stream_ids=None,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
r = await client._store.fetch(invocation_id, None)
|
r = await client._store.fetch(invocation_id, None)
|
||||||
if r[1]:
|
if r[1]:
|
||||||
@@ -304,14 +306,15 @@ class Hub[TState: UserState]:
|
|||||||
return r[0]
|
return r[0]
|
||||||
|
|
||||||
async def call_noblock(self, client: Client, method: str, *args: Any) -> None:
|
async def call_noblock(self, client: Client, method: str, *args: Any) -> None:
|
||||||
await client.send_packet(
|
await self.send_packet(
|
||||||
|
client,
|
||||||
InvocationPacket(
|
InvocationPacket(
|
||||||
header={},
|
header={},
|
||||||
invocation_id=None,
|
invocation_id=None,
|
||||||
target=method,
|
target=method,
|
||||||
arguments=list(args),
|
arguments=list(args),
|
||||||
stream_ids=None,
|
stream_ids=None,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user