From 0ee74f20f7ef681592ca19a3a7784dc95686c3c6 Mon Sep 17 00:00:00 2001 From: "Hamilton R. Amorim" Date: Wed, 14 Dec 2022 22:19:10 -0300 Subject: [PATCH] solving the bug ERR_PUTTING_TO_ROUTING on IPFS.name.publish --- packages/ipfs-core/src/ipns/routing/dht-datastore.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/ipfs-core/src/ipns/routing/dht-datastore.js b/packages/ipfs-core/src/ipns/routing/dht-datastore.js index 62b08eadff..9d2bb17ea2 100644 --- a/packages/ipfs-core/src/ipns/routing/dht-datastore.js +++ b/packages/ipfs-core/src/ipns/routing/dht-datastore.js @@ -24,13 +24,23 @@ export class DHTDatastore { */ async put (key, value, options) { try { - await drain(this._dht.put(key, value, options)) + let responses = this._dht.put(key, value, options); + while(true) { + let item; + try { + item = await responses.next(); + } catch(e) { + if (e.message != "Query aborted") throw e; + } + if (item && item.done) break; + } } catch (/** @type {any} */ err) { log.error(err) throw err } } + /** * @param {Uint8Array} key - identifier of the value to be obtained. * @param {AbortOptions} [options]