From 569f0722c7875c67217daebfd2b5e66b9fb51bf5 Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Tue, 18 Jun 2019 12:56:22 +1000 Subject: [PATCH] Temporary fix to https://github.com/internetarchive/dweb-archive/issues/106 --- TransportGUN.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TransportGUN.js b/TransportGUN.js index 57c3307..90e3499 100644 --- a/TransportGUN.js +++ b/TransportGUN.js @@ -5,7 +5,7 @@ See https://github.com/internetarchive/dweb-mirror/issues/43 for meta issue */ const Url = require('url'); process.env.GUN_ENV = "false"; -const Gun = require('gun/gun.js'); // TODO-GUN switchback to gun/gun at some point to get minimized version +const Gun = require('gun/gun.js'); // gun/gun is the minimized version // Raw Gun has almost nothing in it, it needs at least the following to work properly. require('gun/lib/path.js'); // So that .path works /* @@ -314,7 +314,8 @@ class TransportGUN extends Transport { //WORKAROUND-GUN-PROMISE suggest p_once as a good single addition //TODO-GUN expand this to workaround Gun weirdness with errors. _p_once(gun) { // Note in some cases (e.g. p_getall) this will resolve to a object, others a string/number (p_get) - return new Promise((resolve) => gun.once(resolve)); + // TODO-GUN Temporarily added a 2000ms delay to workaround https://github.com/internetarchive/dweb-archive/issues/106 / https://github.com/amark/gun/issues/762 + return new Promise((resolve) => gun.once(resolve, {wait: 2000})); } async p_keys(url) {