Details
-
Type:
Improvement
-
Status: Invalid
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: ap_association
-
Labels:
-
Team:Alert Production
Description
Currently AssociationTask is associated with an open DB handle, which must be externally closed once the object is no longer in use. This is a problem in the long term because stateful tasks are not supported by the tasks framework, and will be forbidden once SuperTask is released.
DB handles may need to be associated with a call to run rather than with an AssociationTask instance, although I hope there's a better design that I missed.
database access is supposed to be via the butler, and the butler would normally be passed in via the run method. I am guessing in this case the butler cannot write to the database (perhaps due to
DM-11767). If so, passing the db handle to run is very likely better than keeping it a state variable. I have not seen how much violence that does to the code, but if it just means passing the handle from run to other methods then that's a normal pattern.