00:18
Philpax has quit [Read error: Connection reset by peer]
00:28
Philpax has joined #crystal-lang
00:33
<
devinacosta >
Is there a less expensive way in a program to have the program sleep, than using just sleep(seconds)?
00:33
<
devinacosta >
I'm noticing that my program uses 100% of the CPU just sleeping.
00:33
<
devinacosta >
25771 root 20 0 178324 2252 1056 R 100.0 0.0 0:27.30 vzcheck
00:36
<
tilpner >
devinacosta - How long is it sleeping each time?
00:38
<
devinacosta >
Right now I have it sleep 60 seconds.
00:38
<
devinacosta >
I'm basically having to check like 30 websites and then sleep a minute and recheck.
00:38
Oliphaunte has joined #crystal-lang
00:39
<
devinacosta >
Is there a better way so it's not cpu bound?
00:41
<
tilpner >
You must be doing something else or more. A simple sleep in a loop will not cause 100% CPU usage.
00:41
<
devinacosta >
Maybe it's the non-stop loop then?
00:42
<
tilpner >
How much code do you have?
00:42
<
devinacosta >
I create a Fiber for each of my web checks, and then have it sleep a minute.
00:42
<
devinacosta >
Then I have at the bottom:
00:42
<
devinacosta >
While True:
00:42
<
devinacosta >
Fiber.yield
00:43
<
tilpner >
Yes, that looks like it would cause this.
00:43
Oliphaunte has quit [Ping timeout: 250 seconds]
00:43
<
devinacosta >
Tilpner: is there a more correct way of doing it?
00:43
<
devinacosta >
I have the program daemonizing.
00:43
<
tilpner >
Why do you have the yield loop there?
00:44
<
devinacosta >
I just figured it needed to be in the loop?
00:44
<
tilpner >
It should not be necessary.
00:44
<
tilpner >
No yield at all, actually.
00:44
datanoise has joined #crystal-lang
00:45
<
devinacosta >
Tilpner: this is my code:
00:49
<
tilpner >
Huh. Does that even work? It doesn't look like it should.
00:49
<
tilpner >
Why are you not using Crystal sleep?
00:50
<
devinacosta >
I initially didn't have the libC section
00:50
<
devinacosta >
Just tried to see if that makes a difference, If I take out same issue
00:55
<
tilpner >
devinacosta - Replace that "while true Fiber.yield end" loop with "sleep".
00:57
<
devinacosta >
Sweet, I put: loop { sleep }
00:57
<
devinacosta >
That seems to have fixed it.
00:58
<
tilpner >
Just sleep will do.
00:59
<
devinacosta >
Oh ok... Most of the examples I seen that was using that daemonize.cr showed having loop { something }
01:00
<
devinacosta >
Thanks a lot for your help.
01:01
ome has joined #crystal-lang
01:14
matp has quit [Remote host closed the connection]
01:28
devinacosta has quit [Quit: Page closed]
01:33
Oliphaunte has joined #crystal-lang
01:34
<
tilpner >
Uhm... any idea what I can do about XML?
01:35
<
tilpner >
Short of writing the parsing code myself, which could actually be interesting.
01:39
Oliphaunte has quit [Ping timeout: 244 seconds]
01:49
<
tilpner >
Embarassing. I should try the XML module before asking... :(
02:07
pawnbox has quit [Ping timeout: 272 seconds]
02:24
datanoise has quit [Ping timeout: 258 seconds]
02:33
datanoise has joined #crystal-lang
02:35
Oliphaunte has joined #crystal-lang
02:45
Oliphaunte has quit [Read error: Connection reset by peer]
02:48
Oliphaunte has joined #crystal-lang
02:52
pawnbox has joined #crystal-lang
03:09
ome has quit [Quit: Connection closed for inactivity]
03:15
Oliphaunte has quit [Read error: Connection reset by peer]
03:18
Oliphaunte has joined #crystal-lang
03:43
pawnbox has quit [Ping timeout: 264 seconds]
03:55
Oliphaunte has quit [Remote host closed the connection]
04:00
pawnbox has joined #crystal-lang
04:06
pawnbox has quit [Ping timeout: 244 seconds]
04:06
snsei has joined #crystal-lang
04:10
snsei has quit [Remote host closed the connection]
04:20
pawnbox has joined #crystal-lang
04:21
pawnbox has quit [Remote host closed the connection]
04:22
pawnbox has joined #crystal-lang
04:24
Oliphaunte has joined #crystal-lang
04:28
Oliphaunte has quit [Ping timeout: 240 seconds]
04:35
pawnbox has quit [Remote host closed the connection]
04:36
devinacosta has joined #crystal-lang
04:37
pawnbox has joined #crystal-lang
04:37
<
devinacosta >
question when i'm doing an HTTP::Client.get, what would be the proper way to set a timeout?
04:39
pawnbox has quit [Remote host closed the connection]
04:39
pawnbox has joined #crystal-lang
04:46
pawnbox has quit [Remote host closed the connection]
04:46
pawnbox has joined #crystal-lang
04:49
<
tilpner >
(Or the corresponding read_timeout...)
04:49
<
devinacosta >
ahhh ok i'll look at that.. right now i'm just calling HTTP::Client.get "url"
04:50
<
devinacosta >
it looks like it may have hard coded a 60 second timeout.
04:50
<
devinacosta >
doesn't look like it can be changed?
04:50
<
devinacosta >
so maybe i need to try this other method of calling it.
04:52
pawnbox has quit [Remote host closed the connection]
05:03
devinacosta has quit [Ping timeout: 250 seconds]
05:09
pawnbox has joined #crystal-lang
05:11
pawnbox has quit [Remote host closed the connection]
05:11
pawnbox has joined #crystal-lang
05:14
wiiw has quit [Remote host closed the connection]
05:18
Oliphaunte has joined #crystal-lang
05:21
pawnbox has quit [Read error: Connection reset by peer]
05:22
Oliphaunte has quit [Ping timeout: 250 seconds]
05:32
pawnbox has joined #crystal-lang
05:59
soveran has joined #crystal-lang
06:13
Oliphaunte has joined #crystal-lang
06:18
Oliphaunte has quit [Ping timeout: 252 seconds]
06:59
matp has joined #crystal-lang
07:12
pawnbox has quit [Ping timeout: 276 seconds]
07:19
pawnbox has joined #crystal-lang
07:20
mark_66 has joined #crystal-lang
07:27
pawnbox_ has joined #crystal-lang
07:29
pawnbox has quit [Ping timeout: 276 seconds]
07:31
pawnbox_ has quit [Remote host closed the connection]
07:34
pawnbox has joined #crystal-lang
07:36
pawnbox has quit [Remote host closed the connection]
07:37
pawnbox has joined #crystal-lang
07:45
datanoise has quit [Ping timeout: 258 seconds]
07:57
wiiw has joined #crystal-lang
08:03
pawnbox has quit [Remote host closed the connection]
08:22
pawnbox has joined #crystal-lang
08:24
pawnbox has quit [Remote host closed the connection]
08:24
pawnbox has joined #crystal-lang
08:32
Yxhuvud has quit [Remote host closed the connection]
08:32
Yxhuvud has joined #crystal-lang
08:44
datanoise has joined #crystal-lang
08:48
datanoise has quit [Ping timeout: 240 seconds]
08:58
Philpax has quit [Ping timeout: 272 seconds]
09:26
<
jhass >
tilpner: all crystal XML parser lib would very interesting indeed though..
09:27
<
jhass >
looking at all the CVE's libxml2 gets...
09:27
<
tilpner >
A streaming parser too, but those are always more annoying to work with, so I'm glad this one goes with a DOM model.
09:28
<
tilpner >
It just didn't occur to me that someone would put this in their standard library, so I didn't think of looking there. :)
09:45
datanoise has joined #crystal-lang
09:49
datanoise has quit [Ping timeout: 244 seconds]
09:52
<
jhass >
well, the core of oga is a ragel parser
09:59
pawnbox has quit [Remote host closed the connection]
10:00
pawnbox has joined #crystal-lang
10:04
<
RX14 >
i much prefer simple lexers and then recursive descent for parsing personally
10:07
<
RX14 >
guess it depends on what you are parsing
10:11
pawnbox has quit [Remote host closed the connection]
10:11
pawnbox has joined #crystal-lang
10:44
Philpax has joined #crystal-lang
11:16
<
jhass >
well, you certainly want to parse XML deeper than your stack limit, given what people do to XML...
11:20
<
tilpner >
The solution is obviously to increase your stack depth limit! /s
11:31
snsei has joined #crystal-lang
11:41
snsei has quit [Remote host closed the connection]
11:47
datanoise has joined #crystal-lang
11:52
datanoise has quit [Ping timeout: 276 seconds]
11:53
pawnbox has quit [Read error: Connection reset by peer]
12:03
pawnbox has joined #crystal-lang
12:35
Oliphaunte has joined #crystal-lang
12:48
Oliphaunte has quit [Remote host closed the connection]
12:54
Oliphaunte has joined #crystal-lang
12:59
Kurisu has joined #crystal-lang
13:09
Oliphaunte has quit [Remote host closed the connection]
13:10
Oliphaunte has joined #crystal-lang
13:14
Kurisu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
13:20
pawnbox has quit [Remote host closed the connection]
13:31
Kurisu has joined #crystal-lang
13:31
pawnbox has joined #crystal-lang
13:33
pawnbox has quit [Remote host closed the connection]
13:33
pawnbox has joined #crystal-lang
13:42
Oliphaunte has quit [Remote host closed the connection]
13:49
datanoise has joined #crystal-lang
13:53
datanoise has quit [Ping timeout: 276 seconds]
14:16
Oliphaunte has joined #crystal-lang
14:38
cristianoliveira has joined #crystal-lang
14:40
datanoise has joined #crystal-lang
14:40
Kurisu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
14:55
Kurisu has joined #crystal-lang
14:55
Raimondii has joined #crystal-lang
14:58
Raimondi has quit [Ping timeout: 240 seconds]
14:58
buggs1 is now known as buggs
15:03
Philpax has quit [Ping timeout: 252 seconds]
15:06
pawnbox has quit [Ping timeout: 252 seconds]
15:08
Raimondii is now known as Raimondi
15:22
pawnbox has joined #crystal-lang
15:36
soveran has quit [Remote host closed the connection]
15:36
datanoise has quit [Quit: WeeChat 1.5]
15:40
soveran has joined #crystal-lang
15:42
soveran has quit [Remote host closed the connection]
15:51
mark_66 has quit [Remote host closed the connection]
15:57
Kurisu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
16:03
Kurisu has joined #crystal-lang
16:18
Kurisu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
16:31
pawnbox has quit [Remote host closed the connection]
16:36
Kurisu has joined #crystal-lang
16:40
pawnbox has joined #crystal-lang
16:42
pawnbox has quit [Remote host closed the connection]
16:42
soveran has joined #crystal-lang
16:42
soveran has quit [Changing host]
16:42
soveran has joined #crystal-lang
16:42
pawnbox has joined #crystal-lang
16:49
soveran has quit [Ping timeout: 250 seconds]
16:49
Kurisu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
17:04
daemonwrangler has quit [Ping timeout: 272 seconds]
17:04
Kilo`byte has quit [Ping timeout: 272 seconds]
17:05
Raimondii has joined #crystal-lang
17:05
mroth has quit [Ping timeout: 272 seconds]
17:05
jhass has quit [Ping timeout: 272 seconds]
17:05
jnylen has quit [Ping timeout: 272 seconds]
17:06
Oliphaunte has quit [Remote host closed the connection]
17:06
CompanionCube has quit [Ping timeout: 272 seconds]
17:06
Oliphaunte has joined #crystal-lang
17:08
Raimondi has quit [Ping timeout: 240 seconds]
17:09
mroth has joined #crystal-lang
17:09
xxxx has joined #crystal-lang
17:10
Kilo`byte has joined #crystal-lang
17:11
jnylen has joined #crystal-lang
17:12
daemonwrangler has joined #crystal-lang
17:13
wiiw has quit [Ping timeout: 240 seconds]
17:17
xxxx is now known as wiiw
17:17
jhass has joined #crystal-lang
17:18
Raimondii is now known as Raimondi
17:19
CompanionCube has joined #crystal-lang
17:19
CompanionCube has quit [Changing host]
17:19
CompanionCube has joined #crystal-lang
17:21
<
BlaXpirit >
how bad is it to rely on the address of an object being the address of its first item - 4 ?
17:21
<
BlaXpirit >
first member *
17:23
<
jhass >
well it's nothing you'll ever get as a contract I'd say
17:23
<
jhass >
but if you have some way to monitor it still holds true, it's probably ok
17:24
<
BlaXpirit >
that's an idea
17:27
<
BlaXpirit >
i keep wanting an assert statement that is a no-op in release mode
17:28
<
BlaXpirit >
I suppose it's one simple macro away, but it's not as nice
17:44
pawnbox has quit [Remote host closed the connection]
17:53
Oliphaunte has quit [Remote host closed the connection]
18:10
<
crystal-gh >
crystal/master db7c8f8 Ary Borenszweig: Merge pull request #3009 from crystal-lang/feature/to_pretty_json_indent...
18:16
Oliphaunte has joined #crystal-lang
18:32
matp has quit [Remote host closed the connection]
18:37
pawnbox has joined #crystal-lang
18:39
Oliphaunte has quit [Remote host closed the connection]
18:39
Oliphaunte has joined #crystal-lang
18:48
<
crystal-gh >
[crystal] jhass closed pull request #2993: Add support for LLVM 3.8 (master...llvm-3.8)
https://git.io/vK4S9
18:49
matp has joined #crystal-lang
18:57
eserror has joined #crystal-lang
18:59
<
crystal-gh >
crystal/master 19ddb4c Ary Borenszweig: Fixed Makefile to work with LLVM 3.8. Related to #2993
19:28
<
FromGitter >
<sdogruyol> I'm trying to compile Crystal master with LLVM 3.8 and getting this error in ./src/compiler/crystal/codegen/debug.cr:214: undefined constant LibLLVM::IS_36 ⏎ ⏎ {% if LibLLVM::IS_36 || LibLLVM::IS_35 %}
19:29
fryguy9 has joined #crystal-lang
19:32
soveran has joined #crystal-lang
19:35
<
FromGitter >
<sdogruyol> OS 10.11 btw
19:36
<
jhass >
does it work if you add a require "llvm/lib_llvm" to src/compiler/crystal/codegen/debug.cr
19:36
<
FromGitter >
<sdogruyol> lemme try
19:39
<
FromGitter >
<sdogruyol> in ./src/compiler/crystal/codegen/debug.cr:215: undefined constant LibLLVM::IS_36 ⏎ ⏎ {% if LibLLVM::IS_36 || LibLLVM::IS_35 %}
19:39
<
FromGitter >
<sdogruyol> the same error
19:41
<
FromGitter >
<sdogruyol> llvm-config --version ⏎ 3.8.1
19:41
<
jhass >
it's right there
19:41
<
jhass >
it works on travis
19:42
<
jhass >
it worked for omarroth
19:42
<
FromGitter >
<sdogruyol> let me check
19:42
<
jhass >
it apparently worked for Ary
19:42
<
jhass >
it works for me
19:44
<
FromGitter >
<sdogruyol> i dunno it's there for sure IS_36 = {{LibLLVM::VERSION.starts_with?("3.6")}}
19:45
<
FromGitter >
<sdogruyol> c++ -c -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc `/usr/local/opt/llvm/bin/llvm-config --cxxflags` ⏎ cc -fPIC -c -o src/ext/sigfault.o src/ext/sigfault.c ⏎ ar -rcs src/ext/libcrystal.a src/ext/sigfault.o ⏎ CRYSTAL_CONFIG_PATH=`pwd`/src ./bin/crystal build -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib [
https://gitter.im/crystal-lang/crystal?at=578d31df841e619d16ffb33a ]
19:46
<
jhass >
I'm a bit clueless here :/
19:46
<
FromGitter >
<sdogruyol> me too
19:52
<
FromGitter >
<sdogruyol> anything that i can do to debug this further?
19:52
<
FromGitter >
<sdogruyol> or shall i open an issue
20:00
<
jhass >
as said I'm clueless
20:05
<
FromGitter >
<sdogruyol> thanks, i've opened an issue
20:14
<
crystal-gh >
crystal/master 63ca495 Jonne Haß: Prefer llvm-config if it points to 3.8 in Makefile
20:18
<
FromGitter >
<sdogruyol> well, is that because that i try to compiled master with 0.18.7?
20:20
<
FromGitter >
<sdogruyol> compile*
20:25
<
jhass >
nah, I tested it like that
20:25
<
jhass >
travis does it too
20:26
<
jhass >
@sdogruyol ^
20:29
Ven has joined #crystal-lang
21:31
eserror has quit [Read error: Connection reset by peer]
21:35
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:52
fryguy91 has joined #crystal-lang
21:54
fryguy9 has quit [Ping timeout: 252 seconds]
21:58
Oliphaunte has quit [Remote host closed the connection]
22:05
fryguy91 has quit [Quit: Leaving.]
22:15
soveran has quit [Remote host closed the connection]
22:21
cristianoliveira has quit [Ping timeout: 272 seconds]
22:24
soveran has joined #crystal-lang
22:24
soveran has quit [Changing host]
22:24
soveran has joined #crystal-lang
22:29
soveran has quit [Ping timeout: 240 seconds]
22:32
tomchapin has joined #crystal-lang
22:32
tomchapin has quit [Client Quit]
22:36
soveran has joined #crystal-lang
22:36
soveran has quit [Changing host]
22:36
soveran has joined #crystal-lang
22:42
soveran has quit [Remote host closed the connection]
23:24
<
BlaXpirit >
it should be possible to recover the type info
23:26
<
BlaXpirit >
where's A+ when you need it
23:29
<
BlaXpirit >
no, sorry, just forgot the "p"
23:32
<
BlaXpirit >
anyhow, .as(Union(A)) works like a charm
23:41
<
FromGitter >
<aurelien-ldp> Hello ! Is there any way to call a method from a Macro::Def object ?
23:45
<
FromGitter >
<aurelien-ldp> I mean I get method from @type.methods in macro and I want to store it as a Proc for example
23:45
<
BlaXpirit >
try .resolve
23:45
<
BlaXpirit >
oh wait no, you can't do it like that
23:46
<
BlaXpirit >
probably have to reconstruct the path and then just ->{ {{path}} }
23:48
<
BlaXpirit >
but sorry, gotta go.
23:48
deverly has joined #crystal-lang
23:49
<
FromGitter >
<aurelien-ldp> thank you for your answer, I will try
23:50
deverly has quit [Client Quit]
23:51
CompanionCube has joined #crystal-lang
23:51
CompanionCube has quit [Changing host]
23:51
CompanionCube has joined #crystal-lang
23:53
<
FromGitter >
<aurelien-ldp> I’m not sure it is a good practice but `->{ {{method.body}} }` actually works
23:55
<
BlaXpirit >
that will break so easily
23:57
<
BlaXpirit >
i meant more like ->{ Class.{{method.name}} }