diff --git a/lib/service/registry.dart b/lib/service/registry.dart index 9af232e..a5d3cf1 100644 --- a/lib/service/registry.dart +++ b/lib/service/registry.dart @@ -110,10 +110,11 @@ class RegistryService { } final streams = >{}; + final subs = {}; Future get(Uint8List pk) async { final key = Multihash(pk); - if (streams.containsKey(key)) { + if (subs.contains(key)) { node.logger.verbose('[registry] get (subbed) $key'); final res = getFromDB(pk); if (res != null) { @@ -124,6 +125,7 @@ class RegistryService { return getFromDB(pk); } else { sendRegistryRequest(pk); + subs.add(key); streams[key] = StreamController.broadcast(); if (getFromDB(pk) == null) { node.logger.verbose('[registry] get (clean) $key');