cleanupClients function

Future<void> cleanupClients()

Cleans up and closes all cached publisher clients for the current event loop.

Implementation

Future<void> cleanupClients() async {
  final LinkedHashMap<_CacheKey, _CacheEntry> loopCache =
      _publisherClientCache.get();
  final List<_CacheEntry> entries = loopCache.values.toList(growable: false);
  loopCache.clear();
  for (final _CacheEntry entry in entries) {
    await _closeClient(entry.$1);
  }
}