Skip to content

Instantly share code, notes, and snippets.

@noniq
Last active September 15, 2022 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noniq/d07c7ce614b004832385743e03ce8900 to your computer and use it in GitHub Desktop.
Save noniq/d07c7ce614b004832385743e03ce8900 to your computer and use it in GitHub Desktop.
Code reloading with Sidekiq and Zeitwerk (if not using Rails)
loader = Zeitwerk::Loader.new
loader.push_dir(__dir__)
if ENV['RACK_ENV'] == 'production'
loader.setup
Zeitwerk::Loader.eager_load_all
else
loader.enable_reloading
loader.setup
Sidekiq.configure_server do |config|
config[:reloader] = ->(&block){ loader.reload; block.call }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment