jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
decweb has joined #commonlisp
chomwitt has quit [Ping timeout: 252 seconds]
akoana has joined #commonlisp
calx-87 has quit [Ping timeout: 252 seconds]
spdegabrielle has quit [Quit: Connection closed for inactivity]
Oddity has quit [Ping timeout: 248 seconds]
clarkf has quit [Quit: ZNC 1.9.1 - https://znc.in]
random-nick has quit [Ping timeout: 245 seconds]
admich1 has quit [Ping timeout: 248 seconds]
<g-gundam> I've inherited a hunchentoot web service that's having database connectivity issues, and this stackoverflow post sounds really familiar. https://stackoverflow.com/questions/77087733/common-lisp-mito-db-error-connection-to-database-server-lost
<g-gundam> I'd like to give each hunchentoot worker thread its own mito db connection, but I'm not sure how to run a function before every HTTP request. Can anyone advise?
manwithluck has quit [Ping timeout: 276 seconds]
<veqq> Out of curiosity, how'd you inherit the service? You work in a company using CL or?
JuanDaugherty has joined #commonlisp
<g-gundam> veqq: Yeah, got a CL job, and it's my first time using CL.
<veqq> Wow! Quite a few people must envy you!
<g-gundam> I wasn't even looking for work. I was just helping someone with some elisp, and them someone else chimed in to ask if I wanted work.
<veqq> Unfortunately, I don't do much web/networking stuff and can't directly help. I might be able to suggest a way to run a func before requests, but... Could you contextualize how those requests are happening?
* JuanDaugherty doesn, i'd rather do cl (and other langs i like) as a free worker
<veqq> g-gundam: Or rather... What's wrong with the macro advice in the answer you posted? Just replace the func calls with a macro which "prepares" everything by giving the threads their own cons?
<g-gundam> veqq: I'm not familiar enough with hunchentoot to know where I can put that so that it would happen for every request.
<g-gundam> I'd like to follow that advice, but don't know where to put it.
<JuanDaugherty> hunchentoot is pretty simple
<JuanDaugherty> haven used in a while but iirc request processing is quite clearly and cleanly delimited
<JuanDaugherty> assuming it hasn significantly changed in a decade or so which is a good bet
<g-gundam> server definition looks like this: (setf *server* (make-instance 'easy-routes:easy-routes-acceptor :port port))
<g-gundam> then there's a bunch of defroutes for each route.
<JuanDaugherty> oh yeah the easy pkg that hides everything
<veqq> g-gundam: (defclass db-aware-acceptor (hunchentoot:easy-acceptor) ()) and then... stuff?
<JuanDaugherty> you might not wanna use that in ur case
<veqq> Easy routes is there instead so... It might already implement the logic somewhere
<JuanDaugherty> actually that is one thing i tweak from time time
<veqq> might-> it certinly does
<JuanDaugherty> the code running the easy pkg
<g-gundam> veqq: I might have to make my own acceptor. I wasn't sure I wanted to go there (being a CL noob).
<veqq> It'd probably just be 3-4 lines, maybe, hopefully
<veqq> Like/instead of the stackover flow thing, just use progn (like scheme begin) to put the thread preperation logic before whatever you actually want to do
akoana has quit [Quit: leaving]
<g-gundam> veqq: I'm going to explore that path.
<g-gundam> thanks for the advice.
<veqq> Good luck!
<g-gundam> heh. thanks.
<|3b|> you could try using https://sionescu.github.io/bordeaux-threads/threads/default-special-bindings/ to set up the connection binding per thread
<ixelp> Variable *DEFAULT-SPECIAL-BINDINGS*
JuanDaugherty has quit [Quit: praxis.meansofproduction.biz (juan@acm.org)]
kniffy has quit [Quit: zzzz]
<|3b|> or a method on hunchentoot:start-thread (probably lightly more modification of the actual app to do that cleanly)
triffid has quit [Read error: Connection reset by peer]
anticomputer has quit [Read error: Connection reset by peer]
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #commonlisp
triffid has joined #commonlisp
anticomputer has joined #commonlisp
decweb has quit [Quit: Konversation terminated!]
Lord_of_Life has quit [Ping timeout: 265 seconds]
kniffy has joined #commonlisp
<veqq> g-gundam: tagging incase you didn't notice
<g-gundam> veqq: ...the actual make-thread call is deep in the guts of hunchentoot. I don't know if I can manipualte *default-special-bindings* in the right way at the right time.
<g-gundam> keep in mind, i'm still kinda new to CL.
<g-gundam> Thanks for the ping though.
<|3b|> you can set it globally
<veqq> g-gundam: names in asterics are globals
<veqq> so you can just set it anywhere
<g-gundam> is that part of the language? (the asterisk thing)
<g-gundam> or is it convention?
<|3b|> no, they are "specials", which is sort of like globals, but might also be thread-local
<|3b|> ** is convention
<veqq> convention
<|3b|> but a particular name being a "special variable" is part of the language, which is done with declarations (usually automatically by DEFVAR or DEFPARAMETER)
<|3b|> and the convention is there so you don't accidentally get a special variable where you expected a lexical
<|3b|> (and the distinction between global and thread-local/dynamic-binding is important, because that's the problem that we are trying to solve in the first place from what i understood of the link)
<g-gundam> yes, i need thread-local db connections.
stanrifkin_ has joined #commonlisp
stanrifkin has quit [Ping timeout: 252 seconds]
Lord_of_Life has joined #commonlisp
tam has left #commonlisp [deuces]
shka has joined #commonlisp
asarch has joined #commonlisp
edgar-rft` has joined #commonlisp
edgar-rft has quit [Ping timeout: 252 seconds]
asarch has quit [Quit: Leaving]
admich1 has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
<kagevf> g-gundam: maybe you can put an AROUND method on tbnl:handle-request ... something like:
<kagevf> (defmethod tbnl:handle-request :around ((tbnl:*acceptor* your-acceptor-sub-class) (tbnl:*request* tbnl:request))
<kagevf> ... then do you thread stuff ...
<kagevf> (when (next-method-p) (call-next-method)))
<kagevf> ... something like that I think will let you do something on each request
<kagevf> hunchtentoot exposes a lot of generic functions you can specialize on
_whitelogger has joined #commonlisp
istewart has quit [Quit: Konversation terminated!]
<g-gundam> kagevf: i might try that. thanks for the suggestion.
cmack` has joined #commonlisp
cmack has quit [Ping timeout: 252 seconds]
usagi_mimi has joined #commonlisp
admich1 has quit [Ping timeout: 244 seconds]
iNomad has joined #commonlisp
donlcn has joined #commonlisp
pve has joined #commonlisp
Oddity has joined #commonlisp
Oddity has quit [Changing host]
Oddity has joined #commonlisp
rgherdt has joined #commonlisp
ingeniot has joined #commonlisp
calx-87 has joined #commonlisp
Ruby2 has quit [Quit: ZNC - https://znc.in]
lcn_2 has joined #commonlisp
donlcn has quit [Ping timeout: 252 seconds]
Ruby has joined #commonlisp
ewig has joined #commonlisp
JuanDaugherty has joined #commonlisp
gnoo has quit [Ping timeout: 252 seconds]
Guest47 has joined #commonlisp
msv has quit [Remote host closed the connection]
msv has joined #commonlisp
gnoo has joined #commonlisp
msv has quit [Remote host closed the connection]
msv has joined #commonlisp
msv has quit [Remote host closed the connection]
msv has joined #commonlisp
JuanDaugherty has quit [Quit: praxis.meansofproduction.biz (juan@acm.org)]
chomwitt has joined #commonlisp
shawnw has joined #commonlisp
admich1 has joined #commonlisp
GalaxyNova has quit [Ping timeout: 244 seconds]
decweb has joined #commonlisp
chomwitt has quit [Ping timeout: 265 seconds]
runxiyu has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
runxiyu has joined #commonlisp
decweb has quit [Quit: Konversation terminated!]
ingeniot has quit [Ping timeout: 252 seconds]
notzmv has quit [Ping timeout: 265 seconds]
admich1 has quit [Ping timeout: 248 seconds]
Guest47 has quit [Quit: Textual IRC Client: www.textualapp.com]
brainfunnel has quit [Remote host closed the connection]
brainfunnel has joined #commonlisp
apac has joined #commonlisp
LainIwakura has joined #commonlisp
random-nick has joined #commonlisp
decweb has joined #commonlisp
LainIwakura has quit [Quit: Client closed]
_whitelogger has joined #commonlisp
chomwitt has joined #commonlisp
lcn_2 has quit [Remote host closed the connection]
lcn_2 has joined #commonlisp
decweb has quit [Quit: Konversation terminated!]
chomwitt has quit [Ping timeout: 276 seconds]
ingeniot has quit [Ping timeout: 276 seconds]
admich1 has joined #commonlisp
admich1 has quit [Ping timeout: 265 seconds]
admich1 has joined #commonlisp
apac has quit [Ping timeout: 265 seconds]
yitzi has joined #commonlisp
zxcvz has joined #commonlisp
ingeniot has joined #commonlisp
zxcvz has quit [Client Quit]
ewig` has joined #commonlisp
ewig has quit [Ping timeout: 265 seconds]
yitzi has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
bjorkintosh has quit [Remote host closed the connection]
bjorkintosh has joined #commonlisp
bjorkintosh has quit [Changing host]
bjorkintosh has joined #commonlisp
ingeniot has quit [Ping timeout: 252 seconds]
King_julian has joined #commonlisp
bjorkintosh has quit [Remote host closed the connection]
bjorkintosh has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has quit [Changing host]
King_julian has quit [Ping timeout: 248 seconds]
McParen has quit [Remote host closed the connection]
kevingal has joined #commonlisp
wbooze has quit [Quit: Leaving]
ewig` has quit [Read error: Connection reset by peer]
ewig` has joined #commonlisp
ingeniot has joined #commonlisp
ewig` has quit [Ping timeout: 252 seconds]
wbooze has joined #commonlisp
chomwitt has joined #commonlisp
ingeniot has quit [Ping timeout: 245 seconds]
yitzi has joined #commonlisp
ingeniot has joined #commonlisp
kevingal has quit [Ping timeout: 268 seconds]
ewig` has joined #commonlisp
leeb_ has joined #commonlisp
leeb has quit [Ping timeout: 260 seconds]
iNomad has quit [Quit: leaving]
lcn_2 has quit [Ping timeout: 248 seconds]
Noisytoot has quit [Excess Flood]
Noisytoot has joined #commonlisp
Noisytoot has quit [Remote host closed the connection]
Noisytoot has joined #commonlisp
<soweli_iki> is the `continue' restart provided by `assert' only meant to be invoked interactively? i'm overlooking how to provide values for `PLACES'
ingeniot has quit [Ping timeout: 252 seconds]
wbooze has quit [Quit: Leaving]
ewig` has quit [Ping timeout: 244 seconds]
rgherdt has quit [Quit: ERC 5.6.0.30.1 (IRC client for GNU Emacs 30.1)]
<semz> the details of ASSERT's CONTINUE restart are mostly up to the implementation afaik
<soweli_iki> maybe i'm just misunderstanding the restart system; that's an area i could use more experience. i have something like (let ((x 0)) (handler-case (assert (> x 2) (x)) (t () (compute-restarts)))) and the result is a list with only an ABORT restart
phantomics has joined #commonlisp
<beach> soweli_iki: You will probably need HANDLER-BIND rather than HANDLER-CASE.
<soweli_iki> is the proper form something like this? (handler-bind ((t #'(lambda (c) (compute-restarts c)))) (let ...))
<soweli_iki> aha, i think i see my mistake. reading a little more closely the CLHS page for `handler-bind' reveals that the handler is expected to perform a non-local control transfer to interrupt the normal condition handling flow
admich1 has quit [Ping timeout: 252 seconds]
<soweli_iki> thanks beach! that got me unstuck
ingeniot has joined #commonlisp
admich1 has joined #commonlisp
lcn_2 has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
wbooze has joined #commonlisp
rgherdt has joined #commonlisp
notzmv has joined #commonlisp
yitzi has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
slyrus_ has quit []
<beach> Pleasure.
rtypo has joined #commonlisp
ingeniot has quit [Ping timeout: 244 seconds]
lcn_2 has quit [Ping timeout: 252 seconds]
jonatack has quit [Ping timeout: 276 seconds]
apac has joined #commonlisp
chomwitt has quit [Ping timeout: 248 seconds]
uhuh has joined #commonlisp
uhuh has quit [Changing host]
uhuh has joined #commonlisp
mgl has joined #commonlisp
lcn_2 has joined #commonlisp
bitmapper has joined #commonlisp
admich1 has quit [Ping timeout: 252 seconds]
admich1 has joined #commonlisp
mgl has quit []
istewart has joined #commonlisp
mgl has joined #commonlisp
attila_lendvai has joined #commonlisp
mgl has quit []
mgl has joined #commonlisp
GalaxyNova has joined #commonlisp
apac has quit [Ping timeout: 260 seconds]
apac has joined #commonlisp
decweb has joined #commonlisp
g-gundam has quit [Read error: Connection reset by peer]
mgl has quit []
Alfr has quit [Killed (tantalum.libera.chat (Nickname regained by services))]
Alfr has joined #commonlisp
matt` has joined #commonlisp
attila_lendvai has quit [Ping timeout: 265 seconds]
Alfr is now known as Guest5792
Guest5792 has quit [Killed (copper.libera.chat (Nickname regained by services))]
Alfr has joined #commonlisp
matt` has quit [Remote host closed the connection]
chomwitt has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
apac has quit [Ping timeout: 252 seconds]
stanrifkin_ has quit [Quit: Leaving]
yaneko has quit [Quit: parting]
yaneko has joined #commonlisp
chkhd has joined #commonlisp
chkhd has quit [Remote host closed the connection]
JuanDaugherty has joined #commonlisp
chkhd has joined #commonlisp
random-nick has quit [Ping timeout: 260 seconds]
random-nick has joined #commonlisp
chkhd has quit [Ping timeout: 272 seconds]
admich1 has quit [Ping timeout: 252 seconds]
admich1 has joined #commonlisp
rgherdt has quit [Remote host closed the connection]
uhuh has quit [Remote host closed the connection]
shawnw has quit [Ping timeout: 252 seconds]
lcn_2 has quit [Ping timeout: 244 seconds]
jonatack has joined #commonlisp
rkazak has quit [Ping timeout: 260 seconds]
pve has quit [Remote host closed the connection]
jonatack has quit [Ping timeout: 245 seconds]
admich1 has quit [Ping timeout: 252 seconds]