How frequently do you restart shadow-cljs watching server?


#1
  • several times per 10mins
  • many times per hour
  • like once an hour
  • like once in days

0 voters


#2

If you ever restart it for any other reason than upgrading/changing :dependencies or shadow-cljs itself please let me know why!

I might have a solution for having to restart due to :dependencies but nothing yet.


#3

The main reason I restart besides dependency change is that I seem to frequently (every few hours) get a “too many open files” error, and a restart fixes that. Haven’t spent any more time looking at the cause.


#4

I got many…

  • switching projects, I have many projects using shadow-cljs and I have to switch. I have start new watching servers anyway.
  • forgot to add dependencies, like npm modules, somehow I have to restart to make sure the module is loaded after I install it(not sure though).
  • I started watching server in clj RELP, but found myself using wrong configurations, so restart.

The main difference is I have too many tiny projects, whose configurations are slightly different from each other. And I have to restart as soon as something got changed or mistaken.


#5

Can you provide more information? That is definitely not normal. I don’t think that I’m leaking file descriptors but maybe I do?


#6

npm doesn’t require a restart. However there is currently no way to “trigger” a recompile manually. You can do

$ shadow-cljs clj-repl
(shadow/stop-worker :your-build)
(shadow/watch :your-build)

Changing build configuration automatically triggers a rebuild and doesn’t require restarts. Only changes to actual server stuff requires a restart but this will also be fixed at some point.


#7

Thanks, shadow/stop-worker would fix part of my 3rd problem.

For the “wrong config” part. If I forgot to set the right port, like port for socket REPL, or static HTTP server, does shadow-cljs update? I have too many copies of shadow-cljs to make myself confused.


#8

If at all possible never use hard coded ports for the REPLs. You should never enter them by hand and instead when using a tool read the matching target/shadow-cljs/*.port files. It uses random ports by default to avoid any kind of conflicts but you can always find the current port from those files.

Static HTTP servers do not yet restart on config change but I can add that. You can also add :http-port 0 to use a random port which you can then find via the http://localhost:9630 interface.


#9

For :socket-repl, I don’t use it often at current. Just don’t be really random when I want to find the port.

target/shadow-cljs/*.port files , … you can always find the current port from those files.

It’s not hardcoded in my editor. I think it might be nice solution, but my editor doesn’t look up ports in that way yet. My editor starts up in 1s while shadow-cljs is still starting. Besides, I’m not sure about the relative path.

You can also add :http-port 0 to use a random port

I think Webpack’s strategy is fine in my case: try 8080, if not available then 8081, print logs of 8081, and http://localhost:8081 is already in my history. It’s convenient. I restart watching server only when I found ports conflicted.

you can then find via the http://localhost:9630 interface.

Which port defaults to 9630? I constantly got errors of port is already used because sometimes I have to start 3 watching servers in the meantime. I don’t know what it’s used… but just don’t want conflicts.


trying to show how frequently I switch among projects…


#10

https://shadow-cljs.github.io/docs/UsersGuide.html#http


#11

How about changing :source-paths, does shadow-cljs reload?


#12

No.

They affect the classpath and that is static.