Hi everyone! Maybe someone encountered the same ch...
# ktor
a
Hi everyone! Maybe someone encountered the same challenge...
Copy code
lateinit var foo: Foo

fun Application.main() {
  if(!::foo.isInitialized){
    // Initialize foo, which is heavy processing...
  }
  // More code...
}
Is there any way I can avoid re-initializing foo with Autoreload? I hoped the initialization check would work, but it won't.
r
Can't you move the initialization in other file that is not watched by autoreload? Would that work for you?
b
I've done this in some automation work elsewhere where an empty dotfile was used to mark that initialisation is complete, and the code just checked for it. Makes it easy to reinit when you want to, and works fine with auto-reloading as well.