Skip to content

@async instead of Threads.@spawn in listenloop #1231

@theogf

Description

@theogf

Hi!

I was wondering if there is any other reason than legacy for using @async in the listenloop under Servers.jl ?

HTTP.jl/src/Servers.jl

Lines 399 to 407 in 537f50c

conn.host, conn.port = listener.hostname, listener.hostport
@async try
handle_connection(f, conn, listener, readtimeout, access_log, verbose)
finally
# handle_connection is in charge of closing the underlying io
Base.@lock conns_lock delete!(conns, conn)
Base.release(sem)
end
catch e

It feels like we should be able to make the task non-sticky by using Threads.@spawn instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions