<FromGitter>
<watzon> I need to do some cold start benchmarking and see how it compares to Selenium
postmodern has joined #crystal-lang
<raz>
noice!
rocx has joined #crystal-lang
oddp has quit [Ping timeout: 265 seconds]
<FromGitter>
<watzon> Anyone know how to return an image from a kemal route? I've tried returning the raw bytes and the base64 encoded data while setting the content type to "image/png", but that doesn't seem to work.
<FromGitter>
<watzon> Nvm, found `send_file`
<FromGitter>
<sam0x17> is it yet possible to call a macro within a macro?
<FromGitter>
<Blacksmoke16> nope
<FromGitter>
<sam0x17> :(((
<FromGitter>
<sam0x17> k
<FromGitter>
<Blacksmoke16> well kinda, depends on what you mean exactly
<FromGitter>
<sam0x17> I guess I could deal with a macro that writes a macro
<FromGitter>
<sam0x17> sort of situation
<FromGitter>
<sam0x17> I know that's a thing
<FromGitter>
<sam0x17> I have macro A that gets used on it's own and also needs to be used in macro B
<FromGitter>
<watzon> Well I'll have this up for a few minutes if anyone wants to play. Put in a URL and get a screenshot.
twosecslater has left #crystal-lang [#crystal-lang]
<FromGitter>
<watzon> Is it possible to have Kemal routes not block?
<FromGitter>
<Blacksmoke16> block how?
<FromGitter>
<watzon> Well idk if it's Kemal or something else I'm doing, but I have something happening in the route that could take up to 10 seconds, and it's not allowing other routes to go through until the process is finished.
<FromGitter>
<watzon> Hmm I don't think so. By itself the route works fine and sends the response in a reasonable amount of time, its just when I try to make multiple requests to the route at the same time that I have trouble.
<FromGitter>
<Blacksmoke16> something in implementation that locks something so only 1 fiber can access it at a time?
<FromGitter>
<Blacksmoke16> i.e. using a mutex so two separate requests cant access the same file at once?
<FromGitter>
<watzon> I'm using a connection pool, so that shouldn't be an issue
<FromGitter>
<Blacksmoke16> hm
<FromGitter>
<watzon> I'm also watching the system monitor and it's only starting one process from the connection pool. It never grabs a new one because it doesn't get a chance to.
<FromGitter>
<Blacksmoke16> query param delay, sleep that amount, have one tab be `10` and another be `5`, do the longer delay first and assert the shorter delay is done first
<FromGitter>
<Blacksmoke16> fwiw i tried it with athena and thats what happens, so id assume default server is the same
<FromGitter>
<Blacksmoke16> must be something with how kemal is implemented?
<FromGitter>
<Blacksmoke16> er you sure @watzon? I tried my idea and it also worked fine
<FromGitter>
<watzon> Hmm yeah must be the browser. I used curl in three different tabs and it works as expected.
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<watzon> Weird. I would've expected Chrome to run each tab in a different process.
<FromGitter>
<watzon> But whatever, as long as it works
<FromGitter>
<Blacksmoke16> indeed
<FromGitter>
<watzon> I need to add connection pruning to pool
twosecslater has joined #crystal-lang
twosecslater has left #crystal-lang [#crystal-lang]
twosecslater has joined #crystal-lang
zorp_ has joined #crystal-lang
zorp_ has quit [Read error: Connection reset by peer]
<FromGitter>
<watzon> @Blacksmoke16 I'm sure you've had to deal with this. How do you handle boolean annotation parameters that default to true?
<FromGitter>
<watzon> Because `NamedTupleLiteral` has no `#fetch`
<FromGitter>
<watzon> And `ann[:option].nil?` doesn't work for some reason, so I'm having to do `%option = {{ ann[:option] }}.nil? ? true : {{ ann[:option] }}` which is fugly.
<FromGitter>
<phykos> @Blacksmoke16 with 4G + 3G of swap they should be enough to bootstrap the compiler?
<FromGitter>
<Blacksmoke16> id hope so
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
<FromGitter>
<confact> I now have 24 stars on Kindmetrics, most from the crystal community so just want to say thanks. You boost and motivates me on building some cool crystal project!
deavmi has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
HumanG33k has quit [Remote host closed the connection]
deavmi has joined #crystal-lang
<FromGitter>
<phykos> @Blacksmoke16 on `watch swapon --show` it says 267M from a couple of minutes
<FromGitter>
<Blacksmoke16> and it finished?
<FromGitter>
<phykos> Not yet
<FromGitter>
<phykos> 1) 43/3.73 RAM used
<FromGitter>
<phykos> For now
<FromGitter>
<phykos> Running the compiler with `-pts` says this:
<FromGitter>
<asterite> I think you can do `while line = output.gets` then send it to the log. I'm not sure using an IO for this is the best idea. An IO works by doing `write` and that can be any amount of data, but logger works by outputting lines. The buffered trick is nice but I'm not sure it'll always work
<FromGitter>
<watzon> That blocks though doesn't it? So I imagine it would have to be done in a separate fiber?
<jhass>
the edge case it has is that it'll write a line onto two log lines if it exceeds the buffer size. Could argue that a feature though
<FromGitter>
<watzon> Yeah turns out actually logging this process output isn't a good idea anyway
<FromGitter>
<watzon> I need to scan the output for data
<FromGitter>
<grkek> @Blacksmoke16 just accept the PR god damn
<FromGitter>
<Blacksmoke16> 😕
<FromGitter>
<grkek> Whats with that face brother :D
<FromGitter>
<grkek> I mean how do you expect me to download menson, ninja build the project, copy the lib.so to the correct path and then build it on a CI
<FromGitter>
<Blacksmoke16> its probably possible, im kinda skeptical that there is 0 tests you can write. Unrelated to that PR wouldn't that make it *super* hard to work with if there is no way to automate testing to ensure changes dont break anything?
<FromGitter>
<sardaukar> is there a problem with --exclude-warnings in 0.35.1? I have it set to exclude warnings from `/home/sardaukar/.asdf/installs/crystal/0.35.1/share/crystal/src/` and I get warnings from `/home/sardaukar/.asdf/installs/crystal/0.35.1/share/crystal/src/logger.cr:140:3`
<FromGitter>
<asterite> jhass: I think it's convenient to do `a <= b <= c`, also maybe `a == b == c`
<jhass>
I kinda can see a < b < c, though it has the same problem
<jhass>
my problem is that it's special knowledge to parse the chain as a single expression rather than a composed expression
<jhass>
like I kinda knew about a < b < c but never used it because I never felt confident about remembering it right
<jhass>
maybe too much language hopping, but yeah
<FromGitter>
<grkek> @sardaukar I used your elixir bank api example for the event sourced app that is pretty awesome, thank you mate
<FromGitter>
<thelinuxlich> are there any crystal books from 2019-2020?
<FromGitter>
<thelinuxlich> I've bought a great one from PragProg, but it's 2018
<FromGitter>
<sardaukar> @grkek glad you found it useful! :D
<FromGitter>
<sardaukar> question: when you use OptionParser, does --exclude-warnings stop working? I thought if you used `--` to separate Crystal's from your options, OptionParser would only parse yours
<FromGitter>
<Blacksmoke16> what command are you running?
<FromGitter>
<sardaukar> and I get `ERROR: --exclude-warnings=/home/sardaukar/.asdf/installs/crystal/0.35.1/share/crystal/src/logger.cr is not a valid option.`
<FromGitter>
<Blacksmoke16> try doing `crystal run ...`
<FromGitter>
<Blacksmoke16> and move your arguments *before* the file
<FromGitter>
<sardaukar> ok that works! thanks
<FromGitter>
<Blacksmoke16> some of how this worked changed a bit in `0.35.1`
<FromGitter>
<Blacksmoke16> `0.35.0`*
<FromGitter>
<asterite> jhass: I agree with you and if we can remove it from the language I think it's better
<jhass>
probably a 2.0 thing if anything
<jhass>
I wonder if other languages do this though, I feel like I've seen it somewhere else
<jhass>
kotlin maybe?
<jhass>
mh, no they seem to solve it with ranges (x in 1..10)
<FromGitter>
<watzon> Python allows chaining like that
<FromGitter>
<watzon> Iirc
<FromGitter>
<asterite> Yes! Because it seems `True <= 2` is True (wat)
<FromGitter>
<asterite> Oh, my, `True == 1` is True, and `False == 0` is true in Python
<FromGitter>
<watzon> Yeah python has a lot of truthy and falsy values
<FromGitter>
<asterite> Ah, no, chaining works indeed
<FromGitter>
<Blacksmoke16> in ruby `or` and `||` work differently too iirc
<FromGitter>
<asterite> just precedence difference
<FromGitter>
<watzon> Yeah, `||` has a higher precedence
<FromGitter>
<watzon> So it's not possible to create an `HTTP::Client` instance without a host. What should I do when I want people to be able to pass in their own client instance so they can do stuff like add a proxy, or use a completely different method of fetching pages (like with Marionette).
<FromGitter>
<asterite> As far as I know the host is a required header, so that's why
<FromGitter>
<watzon> I think I figured out a solution, just requires a bit more abstraction and an abstract class
<FromGitter>
<watzon> I guess we'll see
rocx has quit [Remote host closed the connection]
HumanG33k has quit [Ping timeout: 264 seconds]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter>
<watzon> Hmm, would've thought that making a field in a JSON serializable object `JSON::Any` would
<FromGitter>
<watzon> have used `JSON.parse` on the raw string
<FromGitter>
<watzon> Instead I end up with a JSON string
HumanG33k has quit [Ping timeout: 240 seconds]
HumanG33k has joined #crystal-lang
Human_G33k has joined #crystal-lang
ep4sh has quit [Quit: WeeChat 1.9.1]
HumanG33k has quit [Ping timeout: 260 seconds]
Human_G33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
ryanprior has joined #crystal-lang
<ryanprior>
I was under the impression that you can disable the gc and do manual memory management with object destructors if you don't want gc, but I can't find any docs for that. Am I making this up or is this a thing?
<FromGitter>
<Blacksmoke16> iirc its like `-Dgc_none` or something like that
<FromGitter>
<watzon> Yeah. You can technically disable the GC, but you also have to run with no standard library since the whole standard library relies on it.
<FromGitter>
<watzon> That is until someone decides to rewrite the entire standard library
<ryanprior>
Ah, but we could have a separate prelude that uses manual memory management if we wanted to?
<ryanprior>
Also is there any documentation for this or is just kinda community insider knowledge?
<ryanprior>
Also how do you manually free an object?