publishPublicSigningKeyLocked method
publishPublicSigningKey without taking the lock, for a caller that already holds it. Taking it twice from one call chain would deadlock: the second acquire waits on a chain entry only the first can complete.
Implementation
Future publishPublicSigningKeyLocked({String? value}) async {
value ??= await publicSigningKeyValue;
String? published;
try {
logger.finer('publishPublicSigningKey: checking $publicSigningKeyUri');
final current = await atClient.get(
AtKey.fromString(publicSigningKeyUri),
getRequestOptions: GetRequestOptions()..useRemoteAtServer = true,
);
published = current.value is String ? current.value as String : null;
} on AtKeyNotFoundException catch (err) {
logger.info('${err.message} - publishing now');
}
if (published == value) {
logger.finer('publishPublicSigningKey: have already published');
return;
}
if (published != null) {
logger.info('publishPublicSigningKey: what is published is not what this '
'client holds - republishing');
}
await atClient.put(
AtKey.fromString(publicSigningKeyUri),
value,
putRequestOptions: PutRequestOptions()..useRemoteAtServer = true,
);
}