createInletsForNodes method
Subscribes to every node in nodes, resolving their endpoints first.
Implementation
@override
Future<void> createInletsForNodes(
Iterable<Node> nodes, {
Duration resolveTimeout = const Duration(seconds: 10),
}) async {
if (nodes.isEmpty) return;
final wanted = nodes.map((n) => n.uId).toSet();
final deadline = DateTime.now().add(resolveTimeout);
while (true) {
final found = await _resolvePublishers(wanted);
if (found.length >= wanted.length) {
for (final handle in found) {
await addInlet(handle);
}
return;
}
for (final handle in found) {
await handle.dispose();
}
if (!DateTime.now().isBefore(deadline)) {
throw StateError(
'Timed out resolving ${wanted.length} publisher(s) of '
'"${config.name}"; found ${found.length}',
);
}
await Future<void>.delayed(const Duration(milliseconds: 25));
}
}