ITADN

Handle the provisioning and purging of custom field data asynchronously

#23010Openjeremystretch 创建于 7 天前
status: acceptednetboxtype: performance
J
jeremystretchcommented
### NetBox Version v4.6.8 ### Python Version 3.14 ### Area(s) of Concern - [x] User Interface - [x] REST API - [ ] GraphQL API - [x] Python ORM - [ ] Other ### Observations Creating and deleting custom fields which are assigned to millions of objects can incur a substantial delay, potentially exceeding the configured request timeout. Two such scenarios are captured under the following bug reports: * #22960 * #22996 This is because, to mitigate potential race conditions, custom field values are provisioned/purged on relevant objects synchronously. ### Proposed Changes We can defer the provisioning of new default values and the purging of all custom field values to asynchronous background jobs so that these potentially long-running operations don't interfere with the request responsible for creating or deleting the field. To mitigate the potential for race conditions mentioned above, we'll add a read-only `status` field to the CustomField model: This will be set to "provisioning" or "deleting" as appropriate to "freeze" the custom field while a bulk operation is under way. Changes will be permitted only to fields in the "active" status.
0 条评论