Fork me on GitHub
#boot
<
2019-01-08
>
jeroenvandijk14:01:47

here's a boot riddle (does work in leiningen and clj):

(let [t (System/nanoTime)]
  (spit "src/foo.clj" (str "(ns foo)\n(def t " t ")")) 
  ;(Thread/sleep 20) delay only required for boot-clj
  (require 'foo :reload) 
  (let [t0 (var-get (resolve 'foo/t))] 
    (if (= t t0) 
      :great 
      (list 'not= t t0))))
I'm expecting :great, but boot-clj doesn't detect the change without a delay

flyboarder16:01:51

@jeroenvandijk I dont understand the question, is this in a repl?

jeroenvandijk16:01:51

yeah it is from the repl. But I ran into the issue running require programmatically

jeroenvandijk16:01:06

So my question is why is there a delay with boot-clj, but not in the other environments

flyboarder16:01:12

@jeroenvandijk this is going to depend on your boot task structure, generally you shouldn’t need to do that unless you are spinning up a pod

flyboarder16:01:35

boot uses a filesystem cache

jeroenvandijk16:01:57

ah that would explain it 🙂

flyboarder16:01:15

the file watchers take time to update

flyboarder16:01:00

but I would say your issue is probably how you are doing the require programmatically

jeroenvandijk16:01:46

So I'm using another file watcher (hawk) that hooks into mac osx events. I guess that this is faster than the boot watcher

flyboarder16:01:46

is this for a boot task or just within the repl for exploration purpose?

jeroenvandijk16:01:24

yeah i'm just using boot as repl now. i'm not using any watch functionality (explicitly)

jeroenvandijk16:01:00

That could be an improvement point maybe, but I don't want to couple it to boot (yet)

jeroenvandijk16:01:19

But the delay is ok for now , at least now I know 🙂

flyboarder16:01:54

yeah we could implement a watch task using Hawk if it becomes a sticking point

jeroenvandijk16:01:57

I guess in this case that could make the issue even more difficult to see as latency would be minimal and it wouldn't happen all the time 🙈

jeroenvandijk16:01:25

I should get rid of the my custom file watcher then

flyboarder16:01:18

what is the file watcher for?

jeroenvandijk16:01:38

i'm trying to implement autotesting at function level

jeroenvandijk16:01:51

like autotest for midje, but much smarter

jeroenvandijk16:01:20

It involves a lot of macro magic so I was a bit afraid that the cause was my rewriting code