Skip to content

Commit

Permalink
Thread s3 uploading with twitter posting
Browse files Browse the repository at this point in the history
Await the completion of both operations
  • Loading branch information
mwunsch committed Aug 3, 2016
1 parent b6ce035 commit 51674a0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/sonic_sketches/core.clj
Expand Up @@ -311,12 +311,16 @@
:day-of-week day-of-week
:iso8601 iso8601})]
(logger/info "Finished recording to" recorded-to "🎶")
(try (upload-to-s3 bucket recorded-to metadata)
(catch Exception e (logger/fatal "Error uploading to s3"
(.getMessage e))))
(try (twitter/tweet recorded-to metadata)
(catch Exception e (logger/fatal "Error posting to Twitter"
(.getMessage e))))
(->> (vector (async/go (try (upload-to-s3 bucket recorded-to metadata)
(catch Exception e (logger/fatal "Error uploading to s3"
(.getMessage e)))))
(async/go (logger/info "Posting" recorded-to "to Twitter")
(try (twitter/tweet recorded-to metadata)
(catch Exception e (logger/fatal "Error posting to Twitter"
(.getMessage e))))))
async/merge
(async/into [])
async/<!!)
{recorded-to metadata})))

(defn -main
Expand Down

0 comments on commit 51674a0

Please sign in to comment.