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)
(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