grimoirelab-sirmordred
grimoirelab-sirmordred copied to clipboard
Avoid deadlock on IDENTITIES_TASKS_ON
Add try-finally to make sure IDENTITIES_TASKS_ON
is switched back to False
when exception happens during execution.
The use of IDENTITIES_TASKS_ON
might cause Mordred
to wait forever when an exception occurs inside task_identities
.
One example of such exception is when the MySQL
server connection goes away temporarily.
Moving it into a try-finally block should avoid this.
I have thought the same during the implementation and probably, we need to follow your PR suggestion. I hate to include all implementation code for a method inside a try block, because indentation and because it points to something that probably should be redesigned. But in this case, probably it is the best approach with the current design. Let me think about it a bit more and I will provide you a final decision.
Thank you very much for this contribution. I hope you to be on the community for some time. It seems you start to know mordred pretty well. How are you learning how the platform works? Reading the code? Reading the GrimoireLab guide?
@acs agree it does not win any beauty contests :-)
Alternative could be to move this as a new "feature" of Task
class. Having some kind of setup()
and teardown()
methods on Task
or alikes. But that would mostly push down the same implementation detail while no other tasks would use it. So arguably that would be only hiding it.
Otherwise probably need a more fundamentally different way of doing this type of syncing of the tasks ?
As for learning; the GrimoireLab guide was helpful understanding the broader architecture but mostly by reading the code.