Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 01 13:26
    asterite synchronize #12551
  • Oct 01 12:27
    asterite review_requested #12551
  • Oct 01 12:27
    asterite review_requested #12551
  • Oct 01 12:27
    asterite labeled #12551
  • Oct 01 12:27
    asterite labeled #12551
  • Oct 01 12:26
    asterite opened #12551
  • Oct 01 11:19
    straight-shoota labeled #12542
  • Oct 01 11:19
    straight-shoota labeled #12542
  • Sep 30 20:54
    oprypin edited #12545
  • Sep 30 17:04
    straight-shoota edited #12530
  • Sep 30 16:06
    straight-shoota labeled #12550
  • Sep 30 16:03
    straight-shoota milestoned #12549
  • Sep 30 16:03
    straight-shoota milestoned #12549
  • Sep 30 16:01
    Hadeweka opened #12550
  • Sep 30 16:01
    Hadeweka labeled #12550
  • Sep 30 14:12
    straight-shoota labeled #12549
  • Sep 30 14:12
    straight-shoota labeled #12549
  • Sep 30 14:12
    straight-shoota labeled #12549
  • Sep 30 14:12
    straight-shoota opened #12549
  • Sep 30 13:54
    straight-shoota closed #12282
From IRC (bridge bot)
@FromIRC
<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
didactic-drunk
@didactic-drunk
It should
From IRC (bridge bot)
@FromIRC
<mps> dies immediately
didactic-drunk
@didactic-drunk
Do you have a client connection open before ctrl+c?
From IRC (bridge bot)
@FromIRC
<mps> yes
didactic-drunk
@didactic-drunk
Works on my end
With your test code
From IRC (bridge bot)
@FromIRC
<mps> hm