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.
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🙂🫡
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
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
@@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.
@@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.
@@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 👍
Very, very important topic. Thanks Rahul!
Glad you liked it!
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.
Great to see you here Bryce and glad it was helpful!
Really nice video on the tooic. Thank you.
Glad you enjoyed it!
Thank you Rahul
Glad you liked it Raghad.
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🙂🫡
Excellent video!
Thank you very much!
Thanks for the video
Glad you liked it John!!
Hi cancellation tokens are not working when calling api from flutter , can you help sir ?
Can you provide more details on how you are using it from flutter ? How are you calling cancel on an API?
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
Using an idempotence along with a state machine do the job.
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
@@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.
@@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.
@@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 👍