<FromGitter>
<HarrisonB> I have the following `TestServer` (https://play.crystal-lang.org/#/r/66wu) that I'm using in a test to ensure another class is sending the right request to the URL it's passed
<FromGitter>
<HarrisonB> But when I try to read the `body` of the `last_request`, the `IO` is closed
<FromGitter>
<HarrisonB> Any way I can get to that before it's closed? or somehow save that value somewhere?
<FromGitter>
<girng> @faustinoaq glad to see you again, wb <3
<FromGitter>
<HarrisonB> @mavu closing the response affects the request?
<FromGitter>
<sdogruyol> Long time no see @faustinoaq 👋 Welcome back!
<FromGitter>
<kingsleyh> Morning
<FromGitter>
<mavu> @HarrisonB Closing the response affects the browser, if your test-server exits before it sends the response. the context.response.print doesn't send. only the response.close actually sends the response on its way. (as far as i understand it)
<FromGitter>
<mavu> @HarrisonB Ehrm . ⏎ I'm sorry. I;m not sure which question I just tried to answer, but it certainly was not yours. Sorry. let me read that again... (I blame the lack of coffee) :)
<FromGitter>
<HarrisonB> Hmm. I’m surprised that compiles given that `body` is typed as a `HTTP::Request?`
<FromGitter>
<HarrisonB> Sorry, `@last_request`
<FromGitter>
<sdzyba> Glad to see you back, @faustinoaq
<FromGitter>
<sdzyba> And thanks for a new release :) hope vscode plugin will continue to evolve
<FromGitter>
<mavu> @HarrisonB true. weird. but does it work ? :)
<FromGitter>
<drum445> Morning
<FromGitter>
<j8r> how can I do with the same file descriptor to open a file, read it with `gets_to_end` and replace its content? "r+" read and append, and "w+" reads nothing and add new content
<FromGitter>
<mavu> @j8r try it with r+ and after reading rewind the IO with .seek. See https://crystal-lang.org/api/0.27.0/IO.html#seek%28offset%2Cwhence%3ASeek%3DSeek%3A%3ASet%29-instance-method
<FromGitter>
<j8r> doesn't looks like it works for me, if my content is `"content"` that i want to replace by `"test"`, it produces `"testent"`
<FromGitter>
<silmanduin66> hello
<FromGitter>
<silmanduin66> between mysql, postgresql and sqlite , which one are you using and why ?
<FromGitter>
<mavu> @j8r maybe then with "w+" instead of "r+" ?
ashirase has quit [Ping timeout: 245 seconds]
ashirase has joined #crystal-lang
<FromGitter>
<j8r> nope, when reading it returns empty/nil
<FromGitter>
<j8r> @silmanduin66 sqlite! Or, I'm experimenting with TiDB
<FromGitter>
<j8r> problem with bare postgresql & mysql is scaling
<FromGitter>
<vladfaust> @proyb6 try putting ‘Fiber.yield’ after ‘server.close’
<FromGitter>
<Qwerp-Derp> the current windows build method is a pain - is there a way to somehow simplify that?
<FromGitter>
<Qwerp-Derp> i have to constantly hop back and forth between my project and the crystal folder in order to build
<FromGitter>
<Qwerp-Derp> personally i think simplifying the windows build process should be more important than the current changes for crystal since the basic infrastructure is already there but there's probably a reason for this
<FromGitter>
<proyb6> @va
<FromGitter>
<proyb6> @vladfaust I tried Fiber.yield similar to straight-shoota and mps were discussed, I wonder if running ```wrk -t1 -c1000 -d15s http://127.0.0.1``` to simulate real traffic is sensible or doesn't matter if it produce socket errors? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c5c26bac2dba5382ef6df07]
<FromGitter>
<vladfaust> What's the question, @proyb6 ?
marmotini_ has quit [Ping timeout: 245 seconds]
<FromGitter>
<kingsleyh> Afternoon
<FromGitter>
<proyb6> Signals seem to shutdown and doesn’t wait for server.close or sleep. My workaround just by placing “sleep 1” at the end of the code.
<FromGitter>
<proyb6> at least to prevent socket “read” error from wrk
<mps>
proyb6: I reached to this http://tpaste.us/kZr9 for now, and I'm still working on it and testing but didn't yet put in production, for now looks fine till the crystal implement 'graceful shutdown'
<FromGitter>
<proyb6> Yeah, I find your temporary workaround seem ok if I add ```sleep 1``` to the last line of code assuming on the most busiest traffic, any late clients' connection won't hit the server that has been completely shutdown and cause to return read error or might be ```Error 500``` on the client's web browser. If what we need is ```server.closing``` to notify, I'm not sure. :)
<mps>
it is intended to close, i.e not accept new connections after signal is received. or I didn't understand what is your goal
jemc has joined #crystal-lang
<FromGitter>
<proyb6> Oh, my goal was to run several server processes with reuse_port enable and will frequently deploy new features without downtime
<mps>
my goal is similar, but one server. when it receives 'shutdown' signal it will close i.e. stop receiving new connections, start new self which will accept new connections and old one will exit after served all accepted before signaled to shutdown. I.O.W. graceful restart server
<mps>
I don't have time to finish it yet, didn't started to work on start self in new process but don't think it will be complicated in crystal because 'all batteries' are there
fanta7531 has joined #crystal-lang
kmctown has joined #crystal-lang
marmotini_ has joined #crystal-lang
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #crystal-lang
<FromGitter>
<j8r> mps I've compiled php 7.3.2 🚀 . I don't know if this is *good* or *bad* to have interpreters linked statically, but that's what Node.js and Crystal do to ship official binaries. It's easy to deploy, but we need to take care of rebuilding it in case of a vulnerability
kmctown has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jemc>
thanks; subscribed
<rkeene>
I read that as "unsubscribed" at first and though "harsh..."
<jemc>
:D
kmctown has joined #crystal-lang
jemc has quit [Ping timeout: 250 seconds]
jemc has joined #crystal-lang
marmotini_ has quit [Ping timeout: 245 seconds]
<mps>
j8r: well, static or dynamic is long time debate and not yet ended, and I think will not be ended soon :)
<mps>
as you know, we build crystal as dynamic by default, but also build static version for building next version when it is released
<FromGitter>
<j8r> i think it depends of the use case, if it's tied to the OS or not at the end - sometimes we haven't the choice
<FromGitter>
<j8r> If we can, dynamic is better :)
<mps>
static version doesn't build automatically but have to triggered 'by hand' calling 'abuild snapshot' which produces tar.gz with static crystal
<FromGitter>
<j8r> ok! didn't know this
<FromGitter>
<j8r> cool
<mps>
you are not wrong in any means by your qustion. We discussed at #alpine-devel about month ago to build it as static apk by default
<mps>
I will work on that, but now I'm working with llvm and batteries to upgrade to version 6, and to bootstrap rust on aarch64 and armv7
<FromGitter>
<j8r> More import, IMHO, is to be able to get rid of dependency hell
<mps>
simply put, short on time, and little slow because I do all that on my free time
marmotini_ has joined #crystal-lang
<FromGitter>
<j8r> A bit like Nix, having app1 that use libcurl 7.62, and app2 using libcurl 7.63, simultaneously
kmctown has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<j8r> you have talked to me about a new refactored apk, I don't don't if this was discussed
<mps>
yes, that is harder to maintain but sometimes only right solution
<FromGitter>
<j8r> *don't know
<FromGitter>
<j8r> good point, there are a lot more packages :/
<mps>
new apk is discussed in very short chat session, because that you probably can't find anything about it
marmotini_ has quit [Ping timeout: 245 seconds]
<FromGitter>
<j8r> that's a 'secret' project :)
<mps>
not secret, but ncopa work on it and no one annoy him about that. from time to time there are questions and some of us answer 'it is worked on' and that's all
<mps>
but apk is not insecure as that man who think he discovered security flaw. or to put it in other words, it is not less secure than other package managers
fanta7531 has quit [Quit: fanta7531]
<mps>
and ncopa works on new extended version to add some new fields and what not, I didn't looked yet at it to be honest
<FromGitter>
<j8r> does apk will be usable outside alpine, and/or as a library, too?
<mps>
I don't know, really, and also didn't hear or read that it will
<FromGitter>
<j8r> what I said doesn't really matter, just questions. But PackageKit would be great :D
<FromGitter>
<j8r> I plan to use it
<FromGitter>
<j8r> anyway, good job Alpiners 👍
<mps>
package managers are not in my field of interest, except tar.gz maybe :)
<FromGitter>
<j8r> lol
<mps>
my first serious linux distro was slackaware and it was/is tar.gz based, although I tried some other before that
<FromGitter>
<faustinoaq> I'm using crecto on 0.27.2 and seems pretty compatible 👍
<FromGitter>
<faustinoaq> but Travis is complaining about something I cant guess 😅
<FromGitter>
<fridgerator> looks like I cant run specs using 0.27.2 for crecto, i'll have to update it
<FromGitter>
<fridgerator> thanks @faustinoaq
marmotini_ has joined #crystal-lang
marmotini_ has quit [Ping timeout: 244 seconds]
marmotini_ has joined #crystal-lang
jemc has quit [Ping timeout: 240 seconds]
kmctown has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jemc has joined #crystal-lang
kmctown has joined #crystal-lang
marmotini_ has quit [Ping timeout: 244 seconds]
marmotini_ has joined #crystal-lang
marmotini_ has quit [Remote host closed the connection]
<FromGitter>
<sam0x17> is `puts` synchronized (i.e. when multi-threading is added later, is there a mutex that prevents puts calls from mangling each other?) or should I be using my own mutex if I am puts-ing from a bunch of different fibers
kmctown has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<j8r> `puts` equals to `STDOUT.puts`
kmctown has joined #crystal-lang
<FromGitter>
<j8r> STDOUT is an IO, the standard output of your program
<FromGitter>
<j8r> You're using a mutex for logging, to have clean log lines?
<FromGitter>
<sam0x17> yes, in C and C++ it is common for multi-threaded code to have printf / std::cout calls that overlap with each other because there is no mutex used when printing
<FromGitter>
<j8r> or, do the logging only on one thread
<FromGitter>
<j8r> you need a mutex when using fibers?
kmctown has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kmctown has joined #crystal-lang
kmctown has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
OvermindDL1 has joined #crystal-lang
<FromGitter>
<Blacksmoke16> had an idea of porting another php lib we use at work for the command bus pattern