Skip to content

Commit 330115c

Browse files
committed
Bump promesa; avoid test flakiness
1 parent 65cfc39 commit 330115c

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
org.clojure/core.async {:mvn/version "1.5.648"}
33
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.3"}
44
cheshire/cheshire {:mvn/version "5.11.0"}
5-
funcool/promesa {:mvn/version "10.0.571"}}
5+
funcool/promesa {:mvn/version "10.0.594"}}
66
:paths ["src" "resources"]
77
:aliases {:test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.64.1010"}}
88
:extra-paths ["test"]

src/lsp4clj/server.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
(deref [_ timeout-ms timeout-val]
3939
(deref p timeout-ms timeout-val))
4040
IBlockingDerefOrCancel
41-
(deref-or-cancel [this timeout-ms timeout-val]
41+
(deref-or-cancel [_ timeout-ms timeout-val]
4242
(let [result (deref p timeout-ms ::timeout)]
4343
(if (identical? ::timeout result)
44-
(do (future-cancel this)
44+
(do (p/cancel! p)
4545
timeout-val)
4646
result)))
4747
clojure.lang.IPending

test/lsp4clj/server_test.clj

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,15 @@
385385
_ (server/start server nil)
386386
req (p/promise (server/send-request server "req" {:body "foo"}))
387387
client-rcvd-msg (h/assert-take output-ch)]
388-
(async/put! input-ch (lsp.responses/response (:id client-rcvd-msg) {:processed 1}))
389-
(is (= {:processed 2} (-> req
390-
(p/timeout 1000 :test-timeout)
391-
(p/then #(update % :processed inc))
392-
(p/extract))))
388+
(async/put! input-ch (lsp.responses/response (:id client-rcvd-msg) {:result :processed
389+
:value 1}))
390+
(is (= {:result :processed
391+
:value 2}
392+
(-> req
393+
(p/timeout 1000 {:result :test-timeout
394+
:value 1})
395+
(p/then #(update % :value inc))
396+
(deref))))
393397
(is (p/done? req))
394398
(is (p/resolved? req))
395399
(is (not (p/rejected? req)))

0 commit comments

Comments
 (0)