         mailserver-removed?
         (connect-to-mailserver cofx)))))
 
-(def limit 2000)
-
 (defn adjust-request-for-transit-time
   [from]
   (let [ttl               (:ttl protocol/whisper-opts)

    (fx/merge cofx
              {:db (update db :mailserver/current-request dissoc :attemps)}
              (change-mailserver))
    (when-let [mailserver (get-mailserver-when-ready cofx)]
      (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 "cursor" cursor)
        {:db (update-in db [:mailserver/current-request :attemps] inc)
         :mailserver/request-messages {:web3    web3
                                       :mailserver   mailserver
                                       :request request}}))))

(fx/defn initialize-mailserver
  [cofx custom-mailservers]
  (fx/merge cofx
            (add-custom-mailservers custom-mailservers)
            (set-current-mailserver)))


    (log/debug "Adjusting mailserver request" "from:" from "adjusted-from:" adjusted-from)
    adjusted-from))

(defn request-messages! [web3 {:keys [sym-key-id address]} {:keys [topics cursor to from] :as request}]
  ;; Add some room to from, unless we break day boundaries so that messages that have
  ;; been received after the last request are also fetched
  (let [adjusted-from (adjust-request-for-transit-time from)
        actual-limit  (or (:limit request)
                          @limit)
        actual-from   (if (> (- to adjusted-from) one-day)
                        from
                        adjusted-from)]
