Skip to content

Commit 2f4c86d

Browse files
authored
Keep track of dynamic proxies too and broadcast messages to them (merge from main #5826) (#6445)
1 parent 640af98 commit 2f4c86d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ydb/library/actors/core/actorsystem.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ namespace NActors {
123123
if (!target) {
124124
target = actorId;
125125
ServiceMap->RegisterLocalService(recipient, target);
126+
DynamicProxies.push_back(target);
126127
}
127128
}
128129
if (target != actorId) {
@@ -230,10 +231,21 @@ namespace NActors {
230231

231232
ui32 TActorSystem::BroadcastToProxies(const std::function<IEventHandle*(const TActorId&)>& eventFabric) {
232233
// TODO: get rid of this method
234+
ui32 res = 0;
233235
for (ui32 i = 0; i < InterconnectCount; ++i) {
234236
Send(eventFabric(Interconnect[i]));
237+
++res;
235238
}
236-
return InterconnectCount;
239+
240+
auto guard = Guard(ProxyCreationLock);
241+
for (size_t i = 0; i < DynamicProxies.size(); ++i) {
242+
const TActorId actorId = DynamicProxies[i];
243+
auto unguard = Unguard(guard);
244+
Send(eventFabric(actorId));
245+
++res;
246+
}
247+
248+
return res;
237249
}
238250

239251
TActorId TActorSystem::LookupLocalService(const TActorId& x) const {

ydb/library/actors/core/actorsystem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ namespace NActors {
161161
TIntrusivePtr<NLog::TSettings> LoggerSettings0;
162162
TProxyWrapperFactory ProxyWrapperFactory;
163163
TMutex ProxyCreationLock;
164+
mutable std::vector<TActorId> DynamicProxies;
164165

165166
bool StartExecuted;
166167
bool StopExecuted;

0 commit comments

Comments
 (0)