Skip to content

Commit 08c4bda

Browse files
committed
[registry] fix outdated reads bug
1 parent 31928ef commit 08c4bda

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/service/registry.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ class RegistryService {
110110
}
111111

112112
final streams = <Multihash, StreamController<SignedRegistryEntry>>{};
113+
final subs = <Multihash>{};
113114

114115
Future<SignedRegistryEntry?> get(Uint8List pk) async {
115116
final key = Multihash(pk);
116-
if (streams.containsKey(key)) {
117+
if (subs.contains(key)) {
117118
node.logger.verbose('[registry] get (subbed) $key');
118119
final res = getFromDB(pk);
119120
if (res != null) {
@@ -124,6 +125,7 @@ class RegistryService {
124125
return getFromDB(pk);
125126
} else {
126127
sendRegistryRequest(pk);
128+
subs.add(key);
127129
streams[key] = StreamController<SignedRegistryEntry>.broadcast();
128130
if (getFromDB(pk) == null) {
129131
node.logger.verbose('[registry] get (clean) $key');

0 commit comments

Comments
 (0)