Skip to content

Commit

Permalink
Merge pull request #627 from Swirrl/fix-memory-leak
Browse files Browse the repository at this point in the history
Fixes #623 memory leak when appending & deleting triples
  • Loading branch information
RickMoynihan authored Aug 15, 2022
2 parents 4ac33bc + e40fe7f commit 96b6bda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions drafter/src/drafter/async/jobs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,12 @@
"Move a job in the pending list into the complete list, adding :complete
and :finish-time metadata."
[{job-id :id :as job}]
(let [job' (assoc job
:status :complete
:finish-time (System/currentTimeMillis))]
(let [job' (-> job
(assoc :status :complete
:finish-time (System/currentTimeMillis))
(dissoc :function) ;; remove function closure as otherwise it will leak batches of quads
(map->Job)
)]
(swap! jobs (fn [jobs]
(-> jobs
(update :pending dissoc job-id)
Expand Down
2 changes: 1 addition & 1 deletion drafter/test/drafter/test_common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
(def job-id-path #"/v1/status/finished-jobs/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})")

(defn job-path->job-id [job-path]
(if-let [uid (second (re-matches job-id-path job-path))]
(when-let [uid (second (re-matches job-id-path job-path))]
(UUID/fromString uid)))

(defn await-completion
Expand Down

0 comments on commit 96b6bda

Please sign in to comment.