Hello everyone, in a very brief way, my service providers are running non-stop all the time, and I'm working on a logic for loading modules, where basically all the logic starts from a Provider, but this thing running every second is driving me crazy.
Has anyone experienced this before?
In my ModuleServiceProvider, in both the register and boot methods, I only have loggers for testing purposes.
Note: the application isn't even open in my browser.
#Crazy service providers?
10 messages · Page 1 of 1 (latest)
A queue or scheduler would also trigger service providers. That's what they do, provide services to the application
It's a clean installation, I haven't made any changes to events or schedules.
Also, the logs happen even when I close the application in the browser.
Throw whatever you want into the laravel logs.
Yeah but I mean like, anything you do that interacts with your app would invoke service providers. Running the queue, running the cron/scheduler, running artisan commands (or even composer install)
I understand, I'd just like to find out why this behavior occurs.
Because as I said, I'm not doing anything (not explicitly) that triggers the providers all the time.
Cron Jobs, Queue Workers, Scheduler, Horizon, Supervisor, Web Crawlers, as soon as you touch a project that is based on Laravel, you are going to be firing up numerous service providers. It's how Laravel works...
PHP pools spinning up/down can also have an impact, as can a number of ISP routers that fingerprint your network to figure out what you're up to.
If you don't want that kind of overhead, you can reduce some of the service providers, or try to implement deferred providers in some cases, but the core service providers are going to be running any time there's anything going on with your project
Rather than just logging "register" and "boot", try logging the service providers that are actually firing, look at your web-server logs to understand if something is accessing it.
I'm really not really sure that I understand quite what the issue you're having is? Using a framework full of service providers, they're going to be booting up, and spinning down any time there's activity
Tomorrow I'll try debugging again, plus some logs.
The problem is basically that the service provider is called all the time, even when the application is not open in the browser (under development).
From what I've seen in the documentation, providers will only run when necessary, and that doesn't seem to be the case here, they're always running and running... endlessly.
It's probably something on your development environment, if you're running Vite Dev, then that could trigger something as it's scanning, your AV could do the same, and I suggested a few other possibilities earlier. It's impossible to tell you why without knowing more
That makes sense, I'll try new things tomorrow.