   (lean-server-send-cmd-async (lean-cmd-valid) 'message))
 
 (defun lean-server-set-timer-for-event-handler ()
+  (lean-server-debug "set-timer-for-event-handler")
   (unless lean-global-retry-timer
     (setq lean-global-retry-timer
           (run-with-idle-timer

        (string-to-send (concat (lean-cmd-to-string cmd) "\n")))
    (lean-server-before-send-cmd cmd)
    ;; Logging
    (lean-server-log
     (string-join
      '("Send"
        "================"
        "%s"
        "================") "\n") string-to-send)
    ;; Trace
    (lean-server-trace
     (format "%s" string-to-send))


(defun lean-server-send-cmd-async (cmd &optional cont)
  "Send cmd to lean-server and attach continuation to the queue."
  (lean-server-debug "send-cmd-async: %S %S" (lean-cmd-type cmd) (cl-second cmd))
  (lean-server-debug "send-cmd-async: queue len = %d" (length lean-global-async-task-queue))
  (lean-server-send-cmd cmd)
  (when cont
    (setq lean-global-async-task-queue (-snoc lean-global-async-task-queue cont))
    (lean-server-cancel-retry-timer)
    (lean-server-debug "send-cmd-async: added to the queue = %S"
                       (length lean-global-async-task-queue))
    (lean-server-debug "send-cmd-async: call handler")
    (lean-server-event-handler)))

(defun lean-server-cancel-retry-timer ()
