BotCommands icon indicating copy to clipboard operation
BotCommands copied to clipboard

Add structures to support hot restarting

Open freya022 opened this issue 7 months ago • 0 comments

Deprecations

  • Deprecated BotCommands#create(<configuration block>)
    • Added an overload accepting the arguments of the main method
  • Deprecated JDAConfiguration.DevTools
    • Replaced with shutdownTimeout in BConfig, which applies to the entire framework's shutdown

New Features

  • Added BContext#shutdown
  • Added BContext#shutdownNow
  • Added BContext#awaitShutdown
  • Added SHUTTING_DOWN and SHUTDOWN in BContext.Status
  • Added BConfig#enableShutdownHook
  • Added BConfig#shutdownTimeout
  • Added BConfig#args
    • Not directly configurable, passed in the entry point or retrieved from Spring
  • Added BRestartConfig
  • Added BShutdownEvent
  • Added ApplicationStartListener
    • Will most likely be only used by the restarter module

Changes

  • Made internal coroutine dispatchers use daemon threads
    • So the JVM can exit if the bot is shut down (assuming the user does not create more non-daemon threads)
  • Moved RequiresDefaultInjection to the API
  • Added isDaemon to namedDefaultScope, defaults to false (compatible)

To do

  • [ ] Don't activate outside of development environments
  • [ ] Fix trying to access JDA from a closed Spring ApplicationContext on shutdown
  • [ ] Have the JDA cache not have a bajillion gotchas
  • [ ] Docs
  • [ ] Fix resource leaks, if any (threads, classes referencing old restart class loaders)
  • [ ] Fix all TODOs

freya022 avatar May 31 '25 17:05 freya022