-
Notifications
You must be signed in to change notification settings - Fork 278
Ubuntu 18.04 aqueduct serve error #494
Comments
And this is my MacBook Pro settings. Its work perfectly Niyazis-MacBook-Pro:niyaziapi niyazitoros$ aqueduct serve |
This isn't in the deployed doc site yet, so I'll quote it here: It is important to understand why Most controllers are immutable - in other words, all of their properties are final and they have no setters. This (mostly) ensures that the controller won't change behavior between requests. When a controller is immutable, the Controllers can be mutable, with the caveat that they cannot be reused for multiple requests. For example, a A mutable class MyControllerState {
dynamic stuff;
}
class MyController extends Controller implements Recyclable<MyControllerState> {
@override
MyControllerState get recycledState => expensiveCalculation();
@override
void restore(MyControllerState state) {
_restoredState = state;
}
MyControllerState _restoredState;
@override
FutureOr<RequestOrResponse> handle(Request request) async {
/* use _restoredState */
return new Response.ok(...);
}
} The |
@joeconwaystk thanks. This is much clear now. I thought every time I create a new controller also after return cleans or remove from GC. "ControllerState get recycledState => expensiveCalculation();" this makes my life easier. Kind Regards |
@joeconwaystk can you give show me where I can get more detil about implements Recyclable. I after I appgrding to 2.0.0.69-4 I am getting recycle error again. Can founf expensiveCalculation(); and I am not sure how to us /* use _restoredState */ in Future<> |
I try to run my web api and got this error....
niyazi@niyazi-virtual-machine:~/aqueduct3_pro/niyaziapi$ aqueduct serve
-- Aqueduct CLI Version: 3.0.0-beta.1
-- Aqueduct project version: 3.0.0-beta.1
-- Preparing...
-- Starting application 'niyaziapi/niyaziapi'
Channel: niyaziapiChannel
Config: /home/niyazi/aqueduct3_pro/niyaziapi/config.yaml
Port: 8888
*** Application failed to start.
*** Uncaught error
Invalid argument(s): Invalid controller 'LoginController'. Controllers must not have setters and all fields must be marked as final, or it must implement 'Recyclable'.
**** Stacktrace
The text was updated successfully, but these errors were encountered: