From fd3152eeff5f2b5c5644aa4336e55e19e6825565 Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Mon, 4 Feb 2019 15:29:47 +0100 Subject: [PATCH] Retry mailserver request with cursor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- src/status_im/mailserver/core.cljs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/status_im/mailserver/core.cljs b/src/status_im/mailserver/core.cljs index 00381bc89c..27d5f7fea0 100644 --- a/src/status_im/mailserver/core.cljs +++ b/src/status_im/mailserver/core.cljs @@ -461,9 +461,11 @@ (if (seq cursor) (when-let [mailserver (get-mailserver-when-ready cofx)] - {:mailserver/request-messages {:web3 (:web3 db) - :mailserver mailserver - :request (assoc request :cursor cursor)}}) + (let [request-with-cursor (assoc request :cursor cursor)] + {:db (assoc db :mailserver/current-request request-with-cursor) + :mailserver/request-messages {:web3 (:web3 db) + :mailserver mailserver + :request request-with-cursor}})) (fx/merge cofx {:db (-> db (dissoc :mailserver/current-request) @@ -552,9 +554,9 @@ {:db (update db :mailserver/current-request dissoc :attemps)} (change-mailserver)) (when-let [mailserver (get-mailserver-when-ready cofx)] - (let [{:keys [topics from to] :as request} (get db :mailserver/current-request) + (let [{:keys [topics from to cursor] :as request} (get db :mailserver/current-request) web3 (:web3 db)] - (log/info "mailserver: message request " request-id "expired for mailserver topic" topics "from" from "to" to) + (log/info "mailserver: message request " request-id "expired for mailserver topic" topics "from" from "to" to "cursor" cursor) {:db (update-in db [:mailserver/current-request :attemps] inc) :mailserver/request-messages {:web3 web3 :mailserver mailserver