This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-05
Channels
- # announcements (17)
- # aws (1)
- # babashka (68)
- # beginners (88)
- # calva (85)
- # chlorine-clover (10)
- # cider (5)
- # cljsrn (4)
- # clojure (99)
- # clojure-android (1)
- # clojure-denmark (1)
- # clojure-europe (15)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-spec (1)
- # clojure-uk (67)
- # clojurescript (44)
- # core-async (44)
- # cryogen (4)
- # cursive (22)
- # data-science (2)
- # datascript (10)
- # datomic (29)
- # duct (11)
- # editors (2)
- # emacs (2)
- # events (1)
- # fulcro (28)
- # ghostwheel (7)
- # graalvm (8)
- # instaparse (6)
- # java (34)
- # jobs (9)
- # jobs-discuss (71)
- # juxt (12)
- # luminus (3)
- # malli (15)
- # meander (9)
- # nrepl (4)
- # off-topic (44)
- # pathom (13)
- # reagent (22)
- # schema (1)
- # shadow-cljs (39)
- # spacemacs (2)
- # test-check (1)
- # tree-sitter (5)
- # xtdb (5)
- # yada (1)
@kwladyka I think since core.async can easily lock up its threads, it distracted us from the fact that it could be your job that do instead
(alt!
(timeout 10000)
:timed-out
(thread
(try
(job)
:success
(catch Throwable ex
:error)))
([result] result))))
Could be useful in the future, if any other job happens to go on forever, then you'll know
Question to others: Would there be a way to get the thread created by core.async thread? So that we could interup it?
pass a channel in to your core.async thread, put the java.lang.Thread/currentThread
on to it ?
listening on an poison-pill kind of chan for this from inside your async/thread is a way to do this. could be a simple promise-chan that you close! to signal exit and then listen to via alts inside the thread
but if your thread is blocking on some i/o, or other monitor, you may need to interrupt it, if it's not going to timeout and clean itself up ?
one thing to think about when exposing the thread is that once the job is done, the thread can be assigned to another job.
oh, yeah, so if you are going to interrupt you really need to be sure that you are interrupting the thing you intend to interrupt, and not the next thing that thread is being re-used for
could be nicely wrapped in, say, an interruptable-thread
fn which returns [result-chan safe-interrupt-fn]
it does rather - which makes sense
If you’re wanting to interrupt stuff then it sounds like a blocking op, which you should not do in a go loop, so you can set those aside. Others threads that do channel work are not special to core.async, they’re just normal threads. If you want to create one and interrupt it, go for it.
I’m assuming you mean like http://Thread.interrupt(). If you mean something less formal, then channels are the best way to communicate information to processes
My initial thought was to wrap the work in async/thread in a future as well and interup that, but I felt dumb double spawning a thread just for that
async/thread does, but async/thread is not special - you can just make your own Thread and do channel stuff on it too
I’m seeing this error in TravisCI: Could not find artifact org.clojure:core.async:jar:1.0.567 in central (
if that's a mirror, could be lagging central (although that's quite a lag)
central: https://repo1.maven.org/maven2/org/clojure/core.async/1.0.567/
I would expect to find core.async jar in that mirror at https://maven-central.storage-download.googleapis.com/repos/central/data/org/clojure/core.async/1.0.567/core.async-1.0.567.jar
but it isn't there
it doesn't have the version before that either (0.7.559)
it does have 0.6.532 which dates back to December
Not sure why Travis is using that mirror — that’s certainly not a mirror I’ve defined in my deps.edn
https://travis-ci.community/t/disable-google-maven-central/5301 — probably a question for tools.deps?
tools.deps is not doing anything to use that
tools.deps does support mirrors in settings.xml so if you set that up, it should take effect