Hey,
Lets say I have my netwrok thread , which inside it I get Data regarding some people,and each record(of 1 man) is being put inside a queue.
I have another Calcthread who reads from that queue and performs some calculation and DB actions. Since the calculation and DB actions take quite amount of time, I though doing the calculations synchronous and the DB insert in another thread, which is only responsible for DB actions. I have 2 issues I'm not sure of:
What will be more effiecient: Using one thread for the DB actions who execute them synchronously, from a queue of actions which the Calcthread write into. Or, just Calling an asynchronous function which insert a record in my DB , for every record I get.
How do I implement it in such a way, such that if inserting to the DB failes, I want to undo all the rest of the actions regarding the same man(record) that was already done ?
Thanks