Skip to content

Commit 2332b9a

Browse files
authored
Longer timeout and better warnings when waiting for the REPL to load (#17)
* Make timeout triangular and about 9.3x longer max; add better warning for when the timeout happens * Bump version * Add hint
1 parent 320e4da commit 2332b9a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BasicAutoloads"
22
uuid = "09cdc199-4954-42dd-9e0c-2e47e8233053"
33
authors = ["Lilith Orion Hafner <[email protected]> and contributors"]
4-
version = "1.0.2"
4+
version = "1.0.3"
55

66
[compat]
77
julia = "1"

src/BasicAutoloads.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,19 @@ struct _WaitRegisterASTTransform{T}
100100
end
101101
function (wrat::_WaitRegisterASTTransform)()
102102
iter = 0
103-
while !isdefined(Base, :active_repl_backend) && iter < 20
104-
sleep(.05)
103+
while !isdefined(Base, :active_repl_backend) && iter < 30
105104
iter += 1
105+
sleep(.02*iter)
106106
end
107-
if isdefined(Base, :active_repl_backend) && isdefined(Base.active_repl_backend, :ast_transforms)
108-
pushfirst!(Base.active_repl_backend.ast_transforms, wrat.ast_transform)
107+
if isdefined(Base, :active_repl_backend)
108+
if isdefined(Base.active_repl_backend, :ast_transforms)
109+
pushfirst!(Base.active_repl_backend.ast_transforms, wrat.ast_transform)
110+
else
111+
@warn "Failed to find Base.active_repl_backend.ast_transforms. Autoloads will not work."
112+
end
109113
else
110-
@warn "Failed to find Base.active_repl_backend.ast_transforms"
114+
@warn "Timed out waiting to Base.active_repl_backend to be defined. Autoloads will not work."
115+
@info "If you have a slow startup file, consider moving `register_autoloads` to the end of it."
111116
end
112117
end
113118

0 commit comments

Comments
 (0)