22 Feb 2024 | |||
SmokeMachine | it seems my request finds the correct route, executes it but continues trying to execute the other routes and then breaks... | 22:07 | |
This a smaller version of this (github.com/FCO/HTML-Component/blob...r.rakumod) where I got this error | 22:14 | ||
lizmat: any idea? | 22:15 | ||
lizmat | nothing jumps out :-( | 22:56 | |
jnthn | SmokeMachine: `where` blocks are not closures; they're traits attached at runtime, so there's one static where block | 22:58 | |
SmokeMachine | But when I print inside of it, it prints the right values… 🤔 | 23:00 | |
gist.github.com/FCO/e08b717af87627...-output-L1 | 23:01 | ||
jnthn: 👆 | |||
jnthn | Try a `print` inside of the `where` | ||
The block is a closure, but a signature is not copied per closure | 23:02 | ||
SmokeMachine | That’s a say inside the when… gist.github.com/FCO/e08b717af87627...ile-cli-L9 | ||
And it continues trying even after a True result… | 23:03 | ||
On my original implementation I had made the test a block and passed the block to the where: github.com/FCO/HTML-Component/blob...akumod#L35 | 23:07 | ||
jnthn: 👆 | 23:09 | ||
jnthn: I tried doing `my &where = -> Int $i, Int $actual { say "$actual == $i -> { $actual == $i }"; $actual == $i }` and used it on when like: `post -> Int $a where &where.assuming: $i {...}` | 23:18 | ||
I 'm still getting: www.irccloud.com/pastebin/bBAmBlLc/ | 23:19 | ||
is there a way to do that inside a loop? | 23:21 | ||
or the only solution is have a single route and do the validation inside of it? | 23:23 | ||
jnthn | Nol the `where` block is not a closure. You can try requesting /0 and /1 and probably observe it always compares against the same RHS | ||
It's either that or something EVAL-y | 23:24 | ||
SmokeMachine | ok, I'll try that...thanks | 23:25 | |
jnthn | You can completely golf Cro out of it, fwiw | 23:26 | |
raku -e 'my @x; ^3.map: -> $i { @x.push(-> $ where { say $i; $_ == $i } { say $i }) }; @x[0](0)' | |||
SmokeMachine | yes... | 23:31 | |
m: my @x; ^3 .map: -> $i { @x.push(-> $ where { say $i; $_ == $i } { say $i }) }; @x[0](2) | |||
oh, sorry... no camelia... :( | |||
23 Feb 2024 | |||
Have anyone seen this? it breaks when receive a request with empty body and content-type application/x-www-form-urlencoded: gist.github.com/FCO/e41f8620aa38a2...7143cadd50 | 23:06 | ||
24 Feb 2024 | |||
jnthn | SmokeMachine: Try upgrading to the latest Cro::HTTP; I think I discovered and fixed that one last month. | 18:03 | |
SmokeMachine | :) thanks, I'll try | 20:01 | |
6 Mar 2024 | |||
Geth | cro-webapp: patrickbkr++ created pull request #88: Fix using template parts via render-template |
21:27 | |
japhb | I took a look at the PR, which seems pretty simple, but it's failing CI ... and as far as I can tell, that's unrelated to the PR, but rather a problem or incompatibility between Digest and the 2021.03 Rakudo release. | 23:36 | |
I want CI to actually be useful for us, so I'm going to try CI'ing with only Rakudo latest. (I've recently come across at least one module that only works in 2023.12 or later *intentionally* so it seems there's a compatibility break there of some kind.) | 23:38 | ||
OK, trying by just running the ubuntu-latest/latest Rakudo job in the CI version matrix, we'll see how it goes. | 23:39 | ||
12 Mar 2024 | |||
Xliff | Wakey wakey? | 00:11 | |
Has anyone done anything with Cro::HTTP::Auth? | |||
japhb | Xliff: A tiny bit: github.com/Raku-MUGS/MUGS-UI-WebSi...on.rakumod | 00:32 | |
Xliff: That defines a session, and then the session-routes() sub here makes use of the definitions: github.com/Raku-MUGS/MUGS-UI-WebSi...es.rakumod | 00:33 | ||
Xliff | Thanks, japhb! I'll take a look, later. | 00:34 | |
japhb | :+1: | ||
patrickb | Cliff: Another case: I use a JWT auth in the RakudoCIBot: github.com/Raku/RakudoCIBot/blob/m...akumod#L20 | 08:17 | |
14 Mar 2024 | |||
melezhik | o/ my cro application (sparky) consumes way too much CPU even being idle, is it typical for cro? | 18:03 | |
basically here the code - github.com/melezhik/sparky/blob/ma...y-web.raku | |||
maybe web sockets do that? | 18:04 | ||
github.com/melezhik/images/blob/0b...21.05.jpeg | 18:06 | ||
github.com/melezhik/sparky/commit/...12e180fc4d | 18:16 | ||
hopefully this will fix this | 18:21 | ||
japhb | melezhik: Did that work? Because no, >2.6 cores at *idle* is really not normal. | 23:48 | |
I did a lot of work on Cro's WebSockets performance, and assuming you're not sending a *continuous* stream of packets or connection requests, or really *large* packets, it should barely even notice it. | 23:50 | ||
15 Mar 2024 | |||
melezhik | . | 12:52 | |
hi japhb, yes this did the trick, basically I had a web socket endpoint gets called all the time from the main page, that produces constant web socket flow and executing uptime command every 10 second, and that consumed a lot of CPU, now this endpoint is not called from web UI - | 12:54 | ||
github.com/melezhik/sparky/blob/ma...#L409-L428 | |||
good lesson for me ) |