You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/12/10 16:58:44 UTC

[incubator-ponymail-foal] 01/02: clear escrow AFTER JSON has been fully fetched, not after 200 response

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit e672215a3918d9006627b978407b1b073ec991bd
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Fri Dec 10 17:58:26 2021 +0100

    clear escrow AFTER JSON has been fully fetched, not after 200 response
---
 webui/js/source/base-http-extensions.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/webui/js/source/base-http-extensions.js b/webui/js/source/base-http-extensions.js
index 54789aa..5ac6238 100644
--- a/webui/js/source/base-http-extensions.js
+++ b/webui/js/source/base-http-extensions.js
@@ -94,7 +94,6 @@ async function GET(url, callback, state) {
             // Since this is an async request, the request may have been canceled
             // by the time we get a response. Only do callback if not.
             if (async_escrow[pkey] !== undefined) {
-                delete async_escrow[pkey]; // move out of escrow when fetched
                 res = rv;
             }
         } catch (e) {
@@ -112,6 +111,7 @@ async function GET(url, callback, state) {
                 js = res_json;
             } else {
                 js = await res.json();
+                delete async_escrow[pkey]; // move out of escrow when fetched
                 async_cache[url] = js;
             }
             if (callback) {
@@ -121,6 +121,7 @@ async function GET(url, callback, state) {
             }
         } else {
             console.log("URL %s returned HTTP code %u, snapping!".format(url, res.status));
+            delete async_escrow[pkey]; // move out of escrow when fetched
             async_snap(res);
         }
     }