JamesRandall / FunctionMonkey

Write more elegant Azure Functions with less boilerplate, more consistency, and support for REST APIs. Docs can be found at https://functionmonkey.azurefromthetrenches.com
MIT License
294 stars 49 forks source link

Receive and add CancellationToken to DI to enable for graceful shutdowns #153

Closed FabBadDog closed 4 years ago

FabBadDog commented 4 years ago

The documentation on this is scarce, but as I understood, before Azure shuts down a function app, it informs the functions about the shutdown through a CancellationToken. Since FunctionMonkey does not declare a CancellationToken as a constructor argument in the function, it does not get the token, hence it is not possible to act on the cancellation request. It would be great if the token was received in the constructor and put in the DI, so that it can be retrieved if needed.

FabBadDog commented 4 years ago

Sorry, I just realized this has already been implemented and I ve just been using an old version.