refactor lockedobjects_db.py
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DragonFlow |
New
|
Medium
|
Lihi Wishnitzer |
Bug Description
There are several issues with lockedobjects_
It is a decorator, which gets a 'type' (defined only locally), which tells it how to find the 'id' by which it locks. This code is overly complex, error prone, and unintuitive.
A more intuitive method would be one of the following:
1. Have a specific decorator per type. The decorator passes a method to extract the lock 'id', rather than figuring it out during locking with a huge (15 elements and counting) if-else dispatch list.
2. Have a context (e.g. 'with lockedobjects_
Reviewed: https:/ /review. openstack. org/560792 /git.openstack. org/cgit/ openstack/ dragonflow/ commit/ ?id=d083aa62117 8d283a98d9f0a7d 57d7b412a68b4b
Committed: https:/
Submitter: Zuul
Branch: master
commit d083aa621178d28 3a98d9f0a7d57d7 b412a68b4b
Author: Omer Anson <email address hidden>
Date: Wed Apr 11 12:29:39 2018 +0300
lockedobjec ts_db: Extract nested lock detection to a method
Partial-Bug: #1740667 b0b846ec92e0df2 09700bc83c5
Change-Id: If349f337ae0279