Skip to content

Commit cc9d7aa

Browse files
committed
1.1.0 upload in parallel where side-effect is eager
1 parent f9e115a commit cc9d7aa

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Boot task `spew` for spewing output files into an s3 bucket.
44

55
[](dependency)
66
```clojure
7-
[tailrecursion/boot-bucket "1.0.0"] ;; latest release
7+
[tailrecursion/boot-bucket "1.1.0"] ;; latest release
88
```
99
[](/dependency)
1010

build.boot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
(require
77
'[adzerk.bootlaces :refer :all])
88

9-
(def +version+ "1.0.0")
9+
(def +version+ "1.1.0")
1010

1111
(bootlaces! +version+)
1212

src/tailrecursion/boot_bucket.clj

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434
(let [src-files* (boot/output-files fileset)
3535
tgt-digests (pod/with-call-in pod
3636
(tailrecursion.boot-bucket.client/list-digests ~*opts*))
37-
src-files (remove #(some (fn [[p h]] (and (= (:path %) p) (= (:hash %) h))) tgt-digests) src-files*)]
38-
(if (empty? src-files)
39-
(util/info "■ no changed files to upload\n")
40-
(do
41-
(doseq [{:keys [dir path]} src-files]
42-
(util/info "• %s\n" path)
43-
(pod/with-call-in pod
44-
(tailrecursion.boot-bucket.client/put-file! ~*opts* ~(.getPath dir) ~path)))
45-
(boot/add-meta fileset (into {} (mapv #(vector (:path %) {::uploaded true}) src-files)))))))))
37+
src-files (remove #(some (fn [[p h]] (and (= (:path %) p) (= (:hash %) h))) tgt-digests) src-files*)
38+
fut-paths (atom [])]
39+
(when (empty? src-files) (util/info "■ no changed files to upload\n"))
40+
(doseq [{:keys [dir path]} src-files]
41+
(->> (tailrecursion.boot-bucket.client/put-file! ~*opts* ~(.getPath dir) ~path)
42+
(pod/with-call-in pod)
43+
(future)
44+
(swap! fut-paths conj)))
45+
(doseq [fut-path @fut-paths]
46+
(util/info "• %s\n" @fut-path))
47+
(boot/add-meta fileset (into {} (mapv #(vector (:path %) {::uploaded true}) src-files)))))))

src/tailrecursion/boot_bucket/client.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@
4141
(defn put-file! [{:keys [access-key secret-key bucket metadata]} base-dir path]
4242
(let [client @(client access-key secret-key)
4343
req (request bucket base-dir path metadata)]
44-
(.putObject client req)))
44+
(.putObject client req)
45+
path))

0 commit comments

Comments
 (0)