Skip to content

Commit c00e83b

Browse files
committed
Fix DiscoveryServer.deregister()
1 parent b2b2c8e commit c00e83b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

coagent/core/discovery.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from pydantic import BaseModel, Field
66

77
from .agent import BaseAgent, Context, handler, Operation
8+
from .exceptions import AgentTypeNotFoundError
89
from .messages import Message
910
from .types import (
1011
Address,
@@ -331,7 +332,12 @@ async def deregister(self, *names: str) -> None:
331332
msg = AgentsDeregistered(
332333
agents=[Schema(name=name) for name in matched_names]
333334
)
334-
await self.channel.publish(addr, msg.encode())
335+
try:
336+
await self.channel.publish(addr, msg.encode())
337+
except AgentTypeNotFoundError:
338+
# The subscribing agent itself has been deregistered.
339+
# Just ignore it.
340+
pass
335341

336342
@handler
337343
async def synchronize(

0 commit comments

Comments
 (0)