Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GlobalSettings onStart fires only after first request

I need to run some code only once when I starts the play server. When using the GlobalSettings.OnStart() I notice that the code is executed only after the first (http) request to the server. Any idea how can I run my code just after the server starts and before any request is sent?

Thanks

like image 349
user2696705 Avatar asked Dec 15 '22 07:12

user2696705


1 Answers

That is the behavior when the application is in development mode, play run. When it's running in production mode, play start, then your onStart method will run immediately when the application starts prior to any requests.

like image 84
estmatic Avatar answered Jan 11 '23 08:01

estmatic