|
1 | 1 | using PrecompileTools: @setup_workload, @compile_workload
|
2 | 2 |
|
3 |
| -@setup_workload begin |
4 |
| - # These need to be safe to call here and bake into the pkgimage, i.e. called twice. |
5 |
| - Connections.__init__() |
6 |
| - MultiPartParsing.__init__() |
7 |
| - Parsers.__init__() |
| 3 | +try |
| 4 | + @setup_workload begin |
| 5 | + # These need to be safe to call here and bake into the pkgimage, i.e. called twice. |
| 6 | + Connections.__init__() |
| 7 | + MultiPartParsing.__init__() |
| 8 | + Parsers.__init__() |
8 | 9 |
|
9 |
| - # Doesn't seem to be needed here, and might not be safe to call twice (here and during runtime) |
10 |
| - # ConnectionRequest.__init__() |
| 10 | + # Doesn't seem to be needed here, and might not be safe to call twice (here and during runtime) |
| 11 | + # ConnectionRequest.__init__() |
11 | 12 |
|
12 |
| - gzip_data(data::String) = read(GzipCompressorStream(IOBuffer(data))) |
| 13 | + gzip_data(data::String) = read(GzipCompressorStream(IOBuffer(data))) |
13 | 14 |
|
14 |
| - # random port in the dynamic/private range (49152–65535) which are are |
15 |
| - # least likely to be used by well-known services |
16 |
| - _port = 57813 |
| 15 | + # random port in the dynamic/private range (49152–65535) which are are |
| 16 | + # least likely to be used by well-known services |
| 17 | + _port = 57813 |
17 | 18 |
|
18 |
| - cert, key = joinpath.(@__DIR__, "../test", "resources", ("cert.pem", "key.pem")) |
19 |
| - sslconfig = MbedTLS.SSLConfig(cert, key) |
| 19 | + cert, key = joinpath.(@__DIR__, "../test", "resources", ("cert.pem", "key.pem")) |
| 20 | + sslconfig = MbedTLS.SSLConfig(cert, key) |
20 | 21 |
|
21 |
| - server = HTTP.serve!("0.0.0.0", _port; verbose = -1, listenany=true, sslconfig=sslconfig) do req |
22 |
| - HTTP.Response(200, ["Content-Encoding" => "gzip"], gzip_data("dummy response")) |
23 |
| - end |
24 |
| - # listenany allows changing port if that one is already in use, so check the actual port |
25 |
| - _port = HTTP.port(server) |
26 |
| - url = "https://localhost:$_port" |
27 |
| - |
28 |
| - env = ["JULIA_NO_VERIFY_HOSTS" => "localhost", |
29 |
| - "JULIA_SSL_NO_VERIFY_HOSTS" => nothing, |
30 |
| - "JULIA_ALWAYS_VERIFY_HOSTS" => nothing] |
31 |
| - withenv(env...) do |
32 |
| - @compile_workload begin |
33 |
| - HTTP.get(url); |
| 22 | + server = HTTP.serve!("0.0.0.0", _port; verbose = -1, listenany=true, sslconfig=sslconfig) do req |
| 23 | + HTTP.Response(200, ["Content-Encoding" => "gzip"], gzip_data("dummy response")) |
| 24 | + end |
| 25 | + # listenany allows changing port if that one is already in use, so check the actual port |
| 26 | + _port = HTTP.port(server) |
| 27 | + url = "https://localhost:$_port" |
| 28 | + |
| 29 | + env = ["JULIA_NO_VERIFY_HOSTS" => "localhost", |
| 30 | + "JULIA_SSL_NO_VERIFY_HOSTS" => nothing, |
| 31 | + "JULIA_ALWAYS_VERIFY_HOSTS" => nothing] |
| 32 | + withenv(env...) do |
| 33 | + @compile_workload begin |
| 34 | + HTTP.get(url); |
| 35 | + end |
34 | 36 | end
|
35 |
| - end |
36 | 37 |
|
37 |
| - HTTP.forceclose(server) |
38 |
| - yield() # needed on 1.9 to avoid some issue where it seems a task doesn't stop before serialization |
39 |
| - server = nothing |
| 38 | + HTTP.forceclose(server) |
| 39 | + yield() # needed on 1.9 to avoid some issue where it seems a task doesn't stop before serialization |
| 40 | + server = nothing |
| 41 | + end |
| 42 | +catch e |
| 43 | + @info "Ignoring an error that occurred during the precompilation workload" exception=(e, catch_backtrace()) |
40 | 44 | end
|
0 commit comments