Closed votti closed 3 months ago
If you agree that this is an issue and the fix 1) would be reasonable, I would be happy to create a PR here and also @AnnotationHub where the issue exists as well.
Agreed. It should not test connection if localhub=TRUE. PR are great otherwise I can look at making this change later this week.
Background I am forced to work on a secure offline system due to data protection reasons.
Issue Every time an
ExperimentHub
instance is instanciated in an offline system without internet connection, a ca 1 minute delay occurred as the Hub tries to connect to the online resource, even iflocalHub=TRUE
is passed.Expected behaviour If the user indicates that the hub is used offline (
localhub=TRUE
) no attempt to connect to the online resource should be made.Root cause I noticed that the current implementation of
ExperimentHub
(andAnnotationHub
) are performing a connection test usingreadBin
upon initialisation even iflocalHub==TRUE
:https://github.com/Bioconductor/ExperimentHub/blob/f758190e13ec31952d2b2b18fdd4261f5652e24d/R/ExperimentHub-class.R#L29-L35
On our system this fails with a timeout of ca 1 minute, thus inducing a 1 minute delay everytime an
ExperimentHub
instance is initialized. This is particular problematic as certain packages (egDMRcate
) are very frequently re-initializing the Hub classes instead of reusing them.Workaround The
readBin
used for the connection test respects the timeoutoptions(timeout = 1)
.This has two issues:
ExperimentHub
(eg downloading things from the internal R repository).Proposed solutions 1) Refactor the
ExperimentHub
initialization to not perform the connection attempt iflocalHub==TRUE
2) use a connection test function that respects a
timeout
that is very small (milliseconds).