Skip to content

Commit e0ee298

Browse files
committed
Change at-async to at-spawn
1 parent 51988fe commit e0ee298

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/Connections.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ function IOExtras.closeread(c::Connection)
299299
c.readable = false
300300
@debugv 3 "✉️ Read done: $c"
301301
if c.clientconnection
302-
t = @async monitor_idle_connection(c)
302+
t = Threads.@spawn monitor_idle_connection(c)
303303
@isdefined(errormonitor) && errormonitor(t)
304304
end
305305
return

src/Exceptions.jl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,15 @@ end # @eval
2828
function try_with_timeout(f, timeout)
2929
ch = Channel(0)
3030
timer = Timer(tm -> close(ch, TimeoutError(timeout)), timeout)
31-
@async begin
32-
try
33-
put!(ch, $f())
34-
catch e
35-
if !(e isa HTTPError)
36-
e = CapturedException(e, catch_backtrace())
37-
end
38-
close(ch, e)
39-
finally
40-
close(timer)
31+
Threads.@spawn try
32+
put!(ch, $f())
33+
catch e
34+
if !(e isa HTTPError)
35+
e = CapturedException(e, catch_backtrace())
4136
end
37+
close(ch, e)
38+
finally
39+
close(timer)
4240
end
4341
return take!(ch)
4442
end

src/clientlayers/StreamRequest.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ function streamlayer(stream::Stream; iofunction=nothing, decompress::Union{Nothi
3333
try
3434
@sync begin
3535
if iofunction === nothing
36-
@async try
36+
Threads.@spawn try
3737
writebody(stream, req)
3838
@debugv 2 "client closewrite"
3939
closewrite(stream)
4040
finally
4141
req.context[:write_duration_ms] = get(req.context, :write_duration_ms, 0.0) + ((time() - write_start) * 1000)
4242
end
4343
read_start = time()
44-
@async try
44+
Threads.@spawn try
4545
@debugv 2 "client startread"
4646
startread(stream)
4747
if isaborted(stream)

0 commit comments

Comments
 (0)