Skip to content

Keep track of dynamic proxies too and broadcast messages to them #5826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ydb/library/actors/core/actorsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ namespace NActors {
if (!target) {
target = actorId;
ServiceMap->RegisterLocalService(recipient, target);
DynamicProxies.push_back(target);
}
}
if (target != actorId) {
Expand Down Expand Up @@ -232,10 +233,21 @@ namespace NActors {

ui32 TActorSystem::BroadcastToProxies(const std::function<IEventHandle*(const TActorId&)>& eventFabric) {
// TODO: get rid of this method
ui32 res = 0;
for (ui32 i = 0; i < InterconnectCount; ++i) {
Send(eventFabric(Interconnect[i]));
++res;
}
return InterconnectCount;

auto guard = Guard(ProxyCreationLock);
for (size_t i = 0; i < DynamicProxies.size(); ++i) {
const TActorId actorId = DynamicProxies[i];
auto unguard = Unguard(guard);
Send(eventFabric(actorId));
++res;
}

return res;
}

TActorId TActorSystem::LookupLocalService(const TActorId& x) const {
Expand Down
1 change: 1 addition & 0 deletions ydb/library/actors/core/actorsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ namespace NActors {
TIntrusivePtr<NLog::TSettings> LoggerSettings0;
TProxyWrapperFactory ProxyWrapperFactory;
TMutex ProxyCreationLock;
mutable std::vector<TActorId> DynamicProxies;

bool StartExecuted;
bool StopExecuted;
Expand Down
Loading