Hello everyone,
I have the following module:
module SideEffects
function __init__()
# load_or_fetch! does an API call to a service to retrieve a list
# OR deserialises an object, if the call has already been done
global MY_DICT = load_or_fetch!(:list)
end
I am not sure if this is a terrible idea, but it worked fine with Julia 1.9 and 1.10 (a bit less sure about that). When updating to 1.11, it gets stuck precompiling because of a I/O task in the background:
Waiting for background task / IO / timer
So I have two questions:
- Is there a better way to achieve this?
- Should I just try to have a completely different approach?
It is very convenient to have this list as sort of a “module constant” and be able to do SideEffects.MY_DICT from multiple places in my code.
Thanks in advance!