これは、タイムアウトを簡単に再現する方法です:
(http/get "http://google.com" {:timeout 1}
(fn [{:keys [status headers body error]}] ;; asynchronous response handling
(if error
(do
(if (instance? org.httpkit.client.TimeoutException error)
(println "There was timeout")
(println "There wasn't timeout"))
(println "Failed, exception is " error))
(println "Async HTTP GET: " status))))
org.httpkit.client.TimeoutException のインスタンスであるエラーを出力します
したがって、マップを受け入れるようにコールバックを変更する必要があります。エラーの場合、このマップの :error フィールドは nil ではなく、タイムアウトの場合は TimeoutException が含まれます。ところで、これはクライアントのドキュメントからわずかに変更された例です-そこでうまく説明されていると思います。
コールバックを次のように変更してみてください。
(defn post-callback
[{:keys [status headers body error]}]
;; and check the error same way as I do above
)