Skip to content
Snippets Groups Projects
Unverified Commit faa29c11 authored by Ryan Senior's avatar Ryan Senior Committed by GitHub
Browse files

Merge pull request #6570 from metabase/async-test-failures

Fix async-test transient failures
parents e3cbfffc ef50df59
No related branches found
No related tags found
No related merge requests found
......@@ -113,17 +113,24 @@
(or (when-let [job (cached-job ctx)]
(callback job (:result (result job)))
(:id job))
(let [{:keys [id] :as job} (db/insert! ComputationJob
:creator_id api/*current-user-id*
:status :running
:type :simple-job
:context ctx)]
(let [{:keys [id] :as job} (db/insert! ComputationJob
:creator_id api/*current-user-id*
:status :running
:type :simple-job
:context ctx)
added-to-running-jobs? (promise)]
(log/info (format "Async job %s started." id))
(swap! running-jobs assoc id (future
(try
;; This argument is getting evaluated BEFORE the swap! associates the id with
;; the future in the atom. If we're unlucky, that means `save-result` will
;; look for the id in that same atom before we've put it there. If that
;; happens we'll never acknowledge that the job completed
@added-to-running-jobs?
(save-result job (f) callback)
(catch Throwable e
(save-error job e callback)))))
(deliver added-to-running-jobs? true)
id)))
(defmacro with-async
......
......@@ -5,7 +5,7 @@
[metabase.test.async :refer :all]))
;; DISABLED due to constant failures 12/6/17. Fix soon!
#_(expect
(expect
true
(let [job-id (compute (gensym) (constantly 42))]
(result! job-id)
......@@ -27,7 +27,7 @@
:result))
;; DISABLED due to constant failures 12/6/17. Fix soon!
#_(expect
(expect
"foo"
(-> (compute (gensym) #(throw (Throwable. "foo")))
result!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment