From 7df8401cced7187b51a8da69348b305cfd4713c8 Mon Sep 17 00:00:00 2001 From: vjrj <vjrj@comunes.org> Date: Sat, 18 Mar 2023 14:14:55 +0100 Subject: [PATCH] Correct wot call --- lib/g1/api.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/g1/api.dart b/lib/g1/api.dart index 6f71c220..c980c348 100644 --- a/lib/g1/api.dart +++ b/lib/g1/api.dart @@ -55,8 +55,10 @@ Not found sample: } */ Future<Contact> getWot(Contact contact) async { - final Response response = - await requestCPlusWithRetry('/wot/lookup/${contact.pubkey}'); + final Response response = await requestDuniterWithRetry( + '/wot/lookup/${contact.pubkey}', + retryWith404: false); + // Will be better to analyze the 404 response (to detect faulty node) if (response.statusCode == HttpStatus.ok) { final Map<String, dynamic> data = json.decode(response.body) as Map<String, dynamic>; @@ -291,6 +293,11 @@ Future<http.Response> requestWithRetry(NodeType type, String path, return _requestWithRetry(type, path, dontRecord, retryWith404); } +Future<http.Response> requestDuniterWithRetry(String path, + {bool retryWith404 = true}) async { + return _requestWithRetry(NodeType.duniter, path, true, retryWith404); +} + Future<http.Response> requestCPlusWithRetry(String path, {bool retryWith404 = true}) async { return _requestWithRetry(NodeType.cesiumPlus, path, true, retryWith404); -- GitLab