You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say we have my_app/config/environment.rb configured like this:
moduleFoodefself.included(klass)puts'Foo was included'endendHanami.configuredomountWeb::Application,at: '/'mailerdoroot'lib/my_app/mailers'delivery:testpreparedoincludeFooendendend
And I have a single mailer class in project. Then it properly calls prepare block once for mailers indicated by output:
Foo was included
But if I want to add additional configuration for some environment, as soon as I specify another mailer block, everything in my initial prepare block gets called another time on app initialisation:
@trafium Could you please tell me more about your context? How do you start your app? Do you use code reloading? Does this happen in production mode? How do you start your app in production mode? Do you use web server clustering?
@jodosha https://github.com/trafium/hanami-mailer-prepare-double-call-bug
Here, I made an example app. My personal project uses hanami-reloader and it is not yet deployed to production, this example repo uses default shotgun, it's reproducible with either. Multiple inclusion can be seen when running bundle exec hanami console
or bundle exec hanami server (in example app you can see Foo is included printed twice on each request).
On startup in production mode (DATABASE_URL="sqlite://db/test_app_development.sqlite" SMTP_PORT="" SMTP_HOST="" HANAMI_ENV=production bundle exec hanami c) the behaviour is the same.
In the context of Hanami app:
Let's say we have
my_app/config/environment.rb
configured like this:And I have a single mailer class in project. Then it properly calls prepare block once for mailers indicated by output:
But if I want to add additional configuration for some environment, as soon as I specify another
mailer
block, everything in my initialprepare
block gets called another time on app initialisation:The text was updated successfully, but these errors were encountered: