This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-26
Channels
- # announcements (1)
- # autochrome-github (1)
- # babashka (9)
- # beginners (112)
- # bristol-clojurians (2)
- # calva (26)
- # cider (10)
- # clj-kondo (31)
- # cljs-dev (40)
- # clojure (114)
- # clojure-austin (1)
- # clojure-dev (112)
- # clojure-europe (22)
- # clojure-germany (5)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-norway (1)
- # clojure-spec (10)
- # clojure-uk (96)
- # clojurescript (39)
- # core-logic (5)
- # datomic (40)
- # fulcro (34)
- # graphql (17)
- # jobs (3)
- # kaocha (4)
- # leiningen (10)
- # luminus (1)
- # malli (3)
- # meander (44)
- # midje (2)
- # off-topic (40)
- # pathom (5)
- # re-frame (8)
- # reitit (8)
- # ring (3)
- # ring-swagger (4)
- # shadow-cljs (83)
- # spacemacs (96)
- # tools-deps (16)
- # vim (4)
- # xtdb (15)
- # yada (20)
@folcon So I just had a look through trying to fathom the lacinia subscriptions stuff because it was on my todo list anyway.
One immediate answer is, "if you are not using lacinia-pedastal to serve your graph over the web, then you'll get subscriptions working only with a rather large headache". It looks like most of the real work is done in the lacinia-pedastal library and the parts of lacinia core that handle subscriptions are effectively written as internal APIs. They are not private as such, but are lower level than the execute
function that acts as the primary public API for executing regular queries.
The entry point for subscriptions, seems to be invoke-streamer
inside the com.walmartlabs.lacinia.executors
ns, but all of the helpful stuff that execute
does, like parsing the query and injecting any variables is bypassed when you invoke at this level. Personally, I think they are desperately missing an execute-subscription
top level API, and maybe I will mess around trying to do a PR for this. As it stands though, best thing to do would be to go through the lacinia code looking at how execute
works. If you look at how execute
prepares a call to execute-query
(via execute-parsed-query
), then it looks like you need to prepare the context object in basically the same way before invoking invoke-streamer
. Though once you do this, you can simply pass your callback function and handle the pushing of any callback invocations down your websocket stream.
If you are are using the lacinia-pedastal library, then as far as I can see it should just work, though you do need to "switch it on". This doesn't seem to be documented on the lacinia-pedastal readme (edit: apparently it is in the manual so you have probably seen this) but subscriptions are turned off by default and you need to pass a {:subscriptions true}
option when you create the pedastal service map, the same way that {:graphiql true}
is shown on the readme. This should start the server listening on /graphql-ws
, which, at least according to the docs (I haven't tested it), should behave the same way as Apollo.
Well I’ve been digging into a not quite completed example that someone whipped up, it’s somewhat instructive? Hopefully it will give me enough of an idea of how things work that I can decide whether lacinia is worth jumping into pedestal for… Code is here -> https://github.com/Folcon/hn-clj-pedestal-re-frame, my current issue is not being sure how I can get session data, and for some reason my com.walmartlabs.lacinia.pedestal.subscriptions
keep disconnecting, not that it appears to do anything…
Re the session data, I’ve tried implementing this: https://raw.githubusercontent.com/transducer/lacinia-pedestal/bf1dba28011fe9f0ae6ab0f2a338dca73edbb5d0/docs/interceptors.rst
but the interceptor never set’s the :lacinia-app-context
, so I can’t even see if the session info is available to be passed on…
I’ve got websockets working at the moment with sente, part of the reason for doing this was to allow the frontend more freedom to specify what it got back from the backend over sockets, so less long polling and more write my own version of graphql for websockets? 😞
Time for bed me thinks =)… I’ll pick this up tomorrow!
I see. Honestly I don't know too much about the client side problems. I am not super happy with the pedestal module for lacinia. I prefer to keep a bit of a closer control of my web tiers. I have a little bit of infrastructure that handles exposing lacinia over the web by only for queries and mutations, had not started looking at subscriptions yet. I might have a play with this. If I find anything useful i'll let you know.
There is, imho, some bad design in all this. It's weird to me that when you do a query lacinia does the main lifting, but when you do subscriptions, lacinia-pedestal does the same lifting.
Morning 🙂
We got yada hooked up with pedestal streams pretty easily. I think there's an example in edge. @folcon
The work in Lacinia pedestal is mostly to work around the fact there's no content negotiation, JSON generation or good async solution in pedestal. Iirc anyway.
månmån
Morning. How is everyone holding up? People with kids doing okay? People living alone staying in touch with other humans via video calls? And everyone in between?
Yeah, pretty much. I'm load balancing my kid with my wife during the day. But the latency can be very high given work responsibilities and nap times.
Yeah, we've got school work we're trying to help our son stay focused on. It feels like an immense task, especially when you throw work into the mix. I wonder how different schools are approaching their teaching strategies with the current lockdown situation.
Our child is 3 years old (nearly), so having a "schedule" doesn't quite work (yet), but we have some things we do - like walk with daddy in the morning and afternoon. As for schools, no idea.
We've been doing exercise classes via YouTube videos. Seems to work well
Yup, been doing that too 😂
I live on my own so I have to say it’s been pretty boring 1.5 weeks so far. 😕
Are you joining any video calls and chatting to people? There are also a few virtual Clojure meetups happening. Is like to try attend sole of those myself
It might even be worth starting a small zoom group or something for people to have some #watercooler time with others struggling with the isolation
Yeah, I’ve been chatting with my family and colleagues and it makes it bearable. I am just a big fan of going into the office for work and being around other people
We have similar things in place, we also have a 3pm tea time hangouts 🙂
Nice, that's really good to hear re the tea time hangouts 👍
Sounds like a Clojure Discord server is on the cards 😀
I would love to be able to program, play VR and consume nothing but pizza and beer for a few weeks
Good luck with the two year old. At least you can't say you're getting bored... Probably just exhausted 😉
morning
morning!
things going... okay here. Luckily we have a garden to put the children in and the weather's been good so far. I imagine this is way harder for a lot of people than it is for me.
It's only week two, but I'm still getting up at my normal hour, running my normal distance, showering, getting dressed in my normal clothes and then going to my "office" (the bedroom next to my own, where I've jury-rigged a stand-up desk with a laptop and external monitor). Let's see how long until I'm working in my bathrobe and slippers... My ears are getting sore from the constant usage of headphones for the videoconferences, though.
Honestly i think this is the best plan, try and stick to your usual routine and adapt it a bit. Well done :thumbsup:
Yes, totally agree. I read/ watched something a while back about having a routine (getting out of bed, making the bed, getting dressed ect) was really healthy and helpful for people when they were unable to work etc. I think the same applies for everyone being stuck at home now. Keep a routine going to keep you going kind of thing
That might have been me banging on about having a well-defined WFH routine and delineating part of your living space as "the office" so you actually "commute" to your office and "commute" home when you're done working.
Having a separate work computer and a home computer also helps (I have a tiny laptop for home stuff and a 27" desktop dedicated to work stuff).
Unfortunately, this isn't feasible/practical for everyone 😞
Yeah, if memory serves me correctly, I think it was a TED talk I watched by someone that used to be in the military (possibly about how to deal with productively working from home), but my memory is a little hazy
Routine is definitely a good thing though. Otherwise the wheels can fall off 😂
Morning folks.
I'm just curious how people that are getting food deliveries booked at all? > Number of users in queue ahead of you: 97524
Don't people feel, given this WFH increase that there seems to be more "control/checking" from up on top? After all, if you're not welded to your keyboard/video conference for at least 12 hours a day, you must be slacking(!) off in your yimyangs watching youtube videos of kitty cats.
Not with us; but we’re a pretty relaxed company — who’ve been doing remote working for years. If anything maybe we’ve gone more the other way… people starting to work more varied hours; and say things like “taking a few hours off to look after the kids” — but then making it up later, so probably overall an increase in flexibility. Though we always allowed that stuff anyway; more people require it now I think.
being avalable on Slack/Email does not strongly correlate with being productiive
Slack is just another outlet for procrastination
/ create space for the subconscious to chew over your current problem as you care to describe it
um I mean that progress is often invisible, especially if it is design-heavy
the whole hammock-time/lotus shoots growing underneath the water thing
from a middle-manager's point of view
they are periously close to being shown up as unnecessary
so haranguing you is their best way to seem relevant
perhaps
probably
Where I work, our team has been split between London and Glasgow for a long time. All meetings are remote-first, even if you were in the office, because no one likes to be the only remote person on the end of an intercom to a room full of people. So when we all had to go home, it wasn't that much of a difference. Where it hurts a bit is in pair programming. Every once in a while, you'd pair with someone in the same office and get a break from the headphones and screen sharing. Now we're on headphones all day, every day. But as far as management is concerned, they've gotten used to not seeing us and stuff still gets done. They're trained.
Glasgow AND London? Is that Previse?
No, BBC. It's in my profile, I think.
Our particular team, which looks after all digital publishing, is primarily based in those two cities.
My thoughts are that we need to let them spy, for a while at least. Give them the initial comfort.
The world seems overall better if society is remote first. Commuting, flying, is reduced. More time to rest, play with kids, etc.
i'm confident you are just holding back because you've seen what happens to all those evil geniuses who spill the beans too early 😉
I'm stuck in OO thinking, i'm not sure I'm thinking this correctly in a FP way. I have api.clj wfich holds this function:
(defn ping-services
"Pings all relevant external services and returns a status map"
[]
(log/debug "Pinging all external services")
{:aggregator "DOWN"
:baas "DOWN"
:ml-service "DOWN"
:database "DOWN"})
Now it hasn't been implemented yet, just returns a fixed map. In my head I'd create aggregator.clj, baas.clj, ml_service.clj and database.clj, each of them would have (amongst other things) a ping function which would know how to ping their service. Then for instance the value would be something like
:database (database/ping)
For some reason this does not feel right. I then started thinking about how I'd actually create tests for this (pins-services) function. In Java I'd just mock the Objects needed and inject them. I was told by one Clojurian that I could use a protocol and SPI Objects (?) for this instead, that is, pass in a function that does the http call (I could then have a function coming from database.clj that actually communicated with the database) and use a pass in a dummy function that returns "TRUE" in tests.
But how would I do that? Or is this a good approach at all?A million ways to do it — but agreggating the results into a map is the trivial bit.
I’d suggest the main place is to test the individual ping procedures… If each of those returned {:service-id "VALUE"}
aggregating them is just a merge. Or they can return [:id value]
and can be put (into {} service-results)
… either way I’d decouple along those kind of lines.
within each ping procedure, you can mock out http things or whatever
or you could call ping-services like (ping-services [ping-service-a ping-service-b])
where each service is just a fn/procedure to do the pinging; and ping-services just orchestrates and collects results. This can be tested with a arbitrary thunks, e.g.
(ping-services [(constantly [:service-a "DOWN"]) (constantly [:service-b "UP"])])
you can obviously bike shed the details — but would suggest something along those lines is a starting point
The important thing is to make this function be part of orchestration I think. Functions take it's result as a parameter, functions don't call it for you
@rickmoynihan @dominicm Good pointers, thanks a million. @dominicm Can you elaborate on that?
ah ok, so you mean passing in the report function, rather than letting ping-services take nothing and call the methods. Ofc that makes testing much easier
Sorry I got pulled away before finishing everything — what @dominicm say’s is totally true btw. Though I was more imagining ping-services would orchestrate the execution of the procedures i.e. provide the strategy rather than report on them per se… At a basic level the distinction isn’t that important, but the orchestration is where the trickier aspects in this sort of thing happen; e.g. whether it’s acceptable for the requests themselves to be made sequentially; or whether they want to occur in parallel… then if parallel how you join the results back together; manage timeouts, different kinds of errors, retries whatever. Keeping those concerns separate from reporting then becomes important etc… it really depends on how far you want to go.
The ping-services function is being called via http endpoint /health, so them taking some time does not matter really, it's really just something I might use to double check setup
Hi isolated peeps! I'm in the market for a clj/cljs formatter - we have emacs, cursive and calva in the team, and calva can't format files with namespaced keywords because of a bug in cljfmt. Does anyone know of an IDE-independent formatter?
i do like 80 chars per line... lets me have 3 column layout in emacs
ohhh - yeuch!
is the bug in cljfmt intractable?