Nice video man. That's was really interesting. Have seen cancellation tokens as an optional parameter to functions all the time but never really saw their purpose.
@RahulNath5 ай бұрын
Great to see you here Bryce and glad it was helpful!
@abuzeromohammed33865 ай бұрын
Thank you Rahul
@RahulNath4 ай бұрын
Glad you liked it Raghad.
@johncerpa37825 ай бұрын
Thanks for the video
@RahulNath5 ай бұрын
Glad you liked it John!!
@SuriyasankarP2 ай бұрын
Hi Sir..First of all it's a great video.. I have one query... I have a main function and that main function has one sub function.. Like Main{ Sub{ Inner 1{ Inner 1.1 } Inner 2{ Inner 2.1} Etcc... } } If I cancel Sub function with cancellation token..all the respective inner function also will cancel and it save resources right?? Or need to pass cancellation token all of the inner function for releasing the resources?? This is my query... If you answer it would be better🙂🫡
@parmarjitesh19795 ай бұрын
Hi cancellation tokens are not working when calling api from flutter , can you help sir ?
@RahulNath5 ай бұрын
Can you provide more details on how you are using it from flutter ? How are you calling cancel on an API?
@parmarjitesh19795 ай бұрын
I am calling a api endpoint for eg : localhost:5010/odata/CHECKSTOCK?PRODUCTID=123. This request is working fine but when the user checks for multiple times stocks of different product and sometimes user generates a request but cancels it mid-way than the cancellation token is not getting trigged and than iis throws error too many files open and i think some memory leak happens and application gets very low, sir googled all possible ways but couldn't figure it out. if u could throw some light than it will be helpfull @@RahulNath
@ramashankar27505 ай бұрын
Using an idempotence along with a state machine do the job.
@RahulNath5 ай бұрын
Sorry didn’t understand. Idempotency is an important concept but not sure how that helps here if you are cancelling out in between a chain of process/ functions
@ramashankar27505 ай бұрын
@@RahulNath Implementing cancellation token on Mircroservices using Azure functions can be a challenge due to racing/multithreading, we implemented the idempotence for the key under consideration that passes through multiple states (optional) validate/ cancel/ secure/ do/ release/ undo/ queueing/ feedback/ webaudit/ tracker/... to minimise it by responding quickly an seting up state machine to cancel duringthe process of task (10-20 tasks for an Invoice) with a transaction engine (we call it DoProcess) to overcome issues in it. e.g we will hold a E-mail to a vendor for 30 minutes before change of mind by the user. towards cancellation , we learnt over decades users issues. feedback state setsup the cancellation state and engine decides its fate. We needed Speed / Robustness/Diagnostics for support/Lean.
@ramashankar27505 ай бұрын
@@RahulNath We do not process the Request immediately but log it and send a feedback to user. Now cancellation becomes easy at any stage with idenmpotence applied (do not know what will fail and get recitified). The queue is processed like 60s/70s era of batch processing replacing the procedures with microservices for maintenance of code, and we use on premise DB in India as companies do not want their data to kept on cloud.
@RahulNath5 ай бұрын
@@ramashankar2750 Absolutely using messaging would help solve a lot of these issues. I did mentioning about it in my previous video on CancellationTokens and long running processes. But when you do run into scenarios like this in your API endpoints or other synchronous processing mechanisms it's good to follow these patterns with the token. Thank you for the comment and the call out here 👍