Skip to content

Commit

Permalink
Longer timeout and better warnings when waiting for the REPL to load (#…
Browse files Browse the repository at this point in the history
…17)

* Make timeout triangular and about 9.3x longer max; add better warning for when the timeout happens

* Bump version

* Add hint
  • Loading branch information
LilithHafner authored Dec 3, 2024
1 parent 320e4da commit 2332b9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BasicAutoloads"
uuid = "09cdc199-4954-42dd-9e0c-2e47e8233053"
authors = ["Lilith Orion Hafner <[email protected]> and contributors"]
version = "1.0.2"
version = "1.0.3"

[compat]
julia = "1"
Expand Down
15 changes: 10 additions & 5 deletions src/BasicAutoloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,19 @@ struct _WaitRegisterASTTransform{T}
end
function (wrat::_WaitRegisterASTTransform)()
iter = 0
while !isdefined(Base, :active_repl_backend) && iter < 20
sleep(.05)
while !isdefined(Base, :active_repl_backend) && iter < 30
iter += 1
sleep(.02*iter)
end
if isdefined(Base, :active_repl_backend) && isdefined(Base.active_repl_backend, :ast_transforms)
pushfirst!(Base.active_repl_backend.ast_transforms, wrat.ast_transform)
if isdefined(Base, :active_repl_backend)
if isdefined(Base.active_repl_backend, :ast_transforms)
pushfirst!(Base.active_repl_backend.ast_transforms, wrat.ast_transform)
else
@warn "Failed to find Base.active_repl_backend.ast_transforms. Autoloads will not work."
end
else
@warn "Failed to find Base.active_repl_backend.ast_transforms"
@warn "Timed out waiting to Base.active_repl_backend to be defined. Autoloads will not work."
@info "If you have a slow startup file, consider moving `register_autoloads` to the end of it."
end
end

Expand Down

2 comments on commit 2332b9a

@LilithHafner
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/120605

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.3 -m "<description of version>" 2332b9af0c564eee43ce86391079d08a4244a5f3
git push origin v1.0.3

Please sign in to comment.