Retry mailserver request with cursor

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Andrea Maria Piana 2019-02-04 15:29:47 +01:00 committed by Jakub Sokołowski
parent 4c4fb6bbe9
commit fd3152eeff
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 7 additions and 5 deletions

View File

@ -461,9 +461,11 @@
(if (seq cursor) (if (seq cursor)
(when-let [mailserver (get-mailserver-when-ready cofx)] (when-let [mailserver (get-mailserver-when-ready cofx)]
{:mailserver/request-messages {:web3 (:web3 db) (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 :mailserver mailserver
:request (assoc request :cursor cursor)}}) :request request-with-cursor}}))
(fx/merge cofx (fx/merge cofx
{:db (-> db {:db (-> db
(dissoc :mailserver/current-request) (dissoc :mailserver/current-request)
@ -552,9 +554,9 @@
{:db (update db :mailserver/current-request dissoc :attemps)} {:db (update db :mailserver/current-request dissoc :attemps)}
(change-mailserver)) (change-mailserver))
(when-let [mailserver (get-mailserver-when-ready cofx)] (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)] 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) {:db (update-in db [:mailserver/current-request :attemps] inc)
:mailserver/request-messages {:web3 web3 :mailserver/request-messages {:web3 web3
:mailserver mailserver :mailserver mailserver