-
Notifications
You must be signed in to change notification settings - Fork 41
Checklist For Speed
- put
Third_Party/ServiceProvider::class => [],
in 'providers_on_worker' in config/laravelfly.php - find out middlewares in that service provider, and you can put them into 'singleton_route_middlewares' or `'singleton_middlewares' if these middlewares are like WORKER SERVICE.
- find out singleton services in that service provider, and decide to make the services to be CLONE SERVICE or WORKER SERVICE (former is simpler but requires more care when using the service).
-
put
Third_Party/ServiceProvider::class => [ 'service_name' => 'clone', ],
-
If its Facade alias maybe used before any requests, put it in 'clean_Facade_on_work' in config/laravelfly.php
-
If other CLONE SERVICEs or WORKER SERVVCEs have ref to this service, update the ref in
update_on_request
in config/laravelfly.php.- By default, amoung Laravel offical services, only app('url') is cloned. If you CLONE SERVICE has an ref to app('url'), you have to update it.
-
There is no ref to this service in your controllers, see controller and stale reference.
-
ensure the service can be WORKER SERVICE, read WORKER SERVICE and WORKER OBJECT. If refactor by extending 3rd party service provider, replace third-party service provider with new service provider.
- singleton
- its vars should restore if a change made in a request and harm the next request.
- If it has ref attibutes, like app['events'] has an attribubte
container
, the attribute container must be also A WORKER SERVICE.
-
put
Third_Party/ServiceProvider::class => [ 'service_name' => true, ],
-
its props will not change in any requests. For associate array type, changed are allowed if there is no harm.
-
if it has ref attibutes, the ref object must be A COROUTINE-FRIENDLY SERVICE.
Give app['events'], it has an attribubtecontainer
, the container must be also A COROUTINE-FRIENDLY SERVICE. Yes, it does, LaravelFly has make necessary refactor.
But for third-party services, you should check out if it usesapp('request')
,app('url')
or something not COROUTINE-FRIENDLY. -
put
Third_Party/ServiceProvider::class => [ 'service_name' => true, ],
-
static props should keep consistent. If coroutine used, they must keep same; if not, the changes in a request should not harm the next request. Refactor not made for following static props of laravel offical services, so pay some attension to them (If you really need refactor, use
use StaticDict
):- Illuminate\Pagination\Paginator::currentPathResolver, currentPageResolver, viewFactoryResolver, defaultView, defaultSimpleView
- Illuminate\Database\Eloquent\Model::globalScopes ( Global Scopes ) is an associated array, its values on the same key should always be same.
- If you use Laravel Macros, an object's Macros with same name should always be same if the object is made on worker, like addGlobalScope.
-
If it has ref to other CLONE SERVICEs like app('url'), update the ref in
update_on_request
in config/laravelfly.php. By default, LaravelFly would output CLONE SERVICEs to console. -
If the service has an ref to app('request'), like (mcamara/laravel-localization it should be updated like this
'update_on_request' => [
[
'this' => 'laravellocalization',
'closure' => function () {
app()->rebinding('request', function () {
$this->request = app('request');
});
}
],
],
- Start
- Coding Guideline
- Deploy and OS Configuration
- New API
- Design
- Dev about Mode Map
- Dev about Mode Backup