Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 03 21:13
    beta-ziliani closed #12555
  • Oct 03 20:50
    straight-shoota closed #12554
  • Oct 03 20:49
    straight-shoota edited #12554
  • Oct 03 18:13
    straight-shoota labeled #12555
  • Oct 03 18:13
    straight-shoota opened #12555
  • Oct 03 17:42
    straight-shoota milestoned #12551
  • Oct 03 17:42
    straight-shoota milestoned #12551
  • Oct 03 15:55
    straight-shoota labeled #12554
  • Oct 03 15:55
    straight-shoota labeled #12554
  • Oct 03 15:55
    straight-shoota edited #12554
  • Oct 03 15:55
    straight-shoota edited #12554
  • Oct 03 15:54
    straight-shoota opened #12554
  • Oct 03 14:44
    straight-shoota milestoned #9326
  • Oct 03 14:44
    straight-shoota milestoned #9326
  • Oct 03 14:40
    straight-shoota labeled #12553
  • Oct 03 14:40
    straight-shoota labeled #12553
  • Oct 03 14:40
    straight-shoota opened #12553
  • Oct 03 14:40
    straight-shoota labeled #12553
  • Oct 03 14:25
    straight-shoota milestoned #12552
  • Oct 03 14:25
    straight-shoota milestoned #12552
Håkan Nylén
@confact
Yea, reduced the memory by 60% with that line of code, thanks @jhass[m].
Gabor Szabo
@szabgab
What is the name of the syntax when the condition comes after the statement? (e.g. break if x > 3) in Perl this is called statement modifier, but I don't know how it is called in Crystal
Gabor Szabo
@szabgab
Thanks
From IRC (bridge bot)
@FromIRC
<mps> is http gracefull shutdown solved (we talked here about it two years ago, iirc)
<mps> (would be nice to remove 'reference' counting from my http servers)
From IRC (bridge bot)
@FromIRC
<straight-shoota> Not sure what was the status back then, but should be mostly solved
<straight-shoota> When you close an HTTP::Server, it shuts down the accept sockets and no new clients will be received. But existing connections continue to be worked.
From IRC (bridge bot)
@FromIRC
<mps> @straight-shoota: ah, thanks. will test it again
<mps> I missed to read that in changes
From IRC (bridge bot)
@FromIRC
<mps> huh, it still doesn't work
<mps> here is my test code https://tpaste.us/xnWw
didactic-drunk
@didactic-drunk
I think the issue is not with the accept socket but lack of tracking already accepted sockets
From IRC (bridge bot)
@FromIRC
<mps> iiuc the problem is in server.closed?
<mps> uh, no
<mps> I had link how to do this in golang but lost this link
didactic-drunk
@didactic-drunk
close. closes the listening sockets. The main fiber waits for all listening sockets to close then exits. It doesn't wait for fibers handling client connections
So it's "half" graceful
From IRC (bridge bot)
@FromIRC
<mps> maybe I need to add Fiber.yield
<mps> hm no, Fiber.yield didn't helped
<mps> have to dig old example on archive disk
<mps> but also have to finish irssi rewrite rules for this channel
From IRC (bridge bot)
@FromIRC
<mps> perl greedy matches make me ... uff
<mps> yes, it should close listening socket but not active ones
didactic-drunk
@didactic-drunk
@mps could you test #10884 and see if it fixes your problem?
Francisco Adasme
@franciscoadasme
hey everyone, is there a way to declare a subtype of a typevar (T::U) in a type restriction?, something like this:
struct Foo; end
struct Foo::Bar; end

module A(T)
  abstract def bar : T::Bar
end

class B
  include A(Foo)

  def bar : Foo::Bar
    Foo::Bar.new
  end
end
George Dietrich
@Blacksmoke16
include A(Foo::Bar)
and just use T
From IRC (bridge bot)
@FromIRC
<mps> @didactic-drunk: I have to rebuild crystal for this, iiuc
didactic-drunk
@didactic-drunk
You could possibly use an existing 1.0.0 build
From IRC (bridge bot)
@FromIRC
<mps> I don't keep it around because my arm64 machines are too slow to build crystal
Francisco Adasme
@franciscoadasme
@Blacksmoke16 This was a simplified example, the module includes other methods that work on T, so I cannot simply use Foo::Bar
George Dietrich
@Blacksmoke16
include A(Foo, Foo::Bar)?
From IRC (bridge bot)
@FromIRC
<mps> @didactic-drunk: btw, I maintain crystal in last 2 years for alpine linux
<mps> for any change I have to use alpine builders and to push changes to distro
<mps> @didactic-drunk: anyway I will try this patch on my local box on weekend, thank you for it
didactic-drunk
@didactic-drunk
You can probably use an existing compiled 1.0.0 crystal binary with the std lib source from my branch (or just copy http/server.cr)
From IRC (bridge bot)
@FromIRC
<mps> ah, lets see
From IRC (bridge bot)
@FromIRC
<mps> @didactic-drunk: In /usr/lib/crystal/core/http/server.cr:505:9
<mps> 505 | sleep timeout
<mps> Error: no overload matches 'sleep' with type Nil
<mps> but looking into patch, this is some kind of reference counting also?
didactic-drunk
@didactic-drunk
Did you use close with or without a timeout?
From IRC (bridge bot)
@FromIRC
<mps> without timeout, I want to close listening socket imediately
didactic-drunk
@didactic-drunk
Try close timeout: 0
Um. Listening sockets are closed immediately regardless of timeout. Timeout is the wait time for already accepted client connections
From IRC (bridge bot)
@FromIRC
<mps> yes, patch didn't helped
didactic-drunk
@didactic-drunk
Try timeout: 80
From IRC (bridge bot)
@FromIRC
<mps> will this close listening socket imediately?
<mps> even with 'timeout: 80' doesn't work