Liquid-Application-Framework-1.0-deprecated icon indicating copy to clipboard operation
Liquid-Application-Framework-1.0-deprecated copied to clipboard

Remove LightBackgroundTask

Open bruno-brant opened this issue 4 years ago • 0 comments

There's no clear purpose for LightBackgroundTask.

One one hand, it's a simple implementation of IHostedService, with little functionality added (looped executing of ProcessAsync while !IsCancellationRequested, it seems). There's no need to provide a base class for this kind of functionality. The implementation also has a number of pitfalls (ProcessAsync will be called in parallel, a derived class can reimplement IHostedService methods since they weren't sealed, the Cancel call won't stop the executing thread, etc.

On the other, scheduled functions are better managed by a external scheduler. Liquid is designed to be run in containers, where we expect multiple instances of each service. A background task such as this will end up running in every container, indiscriminately, which usually isn't what the author intended; also, the container manager may terminate a controller for a multiple number of reasons, and this background task will be stopped.

I think we should remove this from future version as it's clutter and not related to Liquid's core functionality (API/microservices).

bruno-brant avatar Nov 25 '19 14:11 bruno-brant