Every non-bulk change enqueues its own Search cache update job instead of coalescing — RQ queue flood
NetBox Edition
NetBox Community
NetBox Version
4.7.0
Python Version
3.14
Steps to Reproduce
- On NetBox 4.7.0 with an RQ worker running, use the REST API (or the ORM directly) to create or update a large number of objects (e.g. a few thousand) of a searchable model type, one at a time (not via bulk endpoints/bulk_create).
- Observe the RQ default queue / Background Jobs list.
Expected Behavior
No spam of Search cache update jobs
Observed Behavior
A separate Search cache update job is enqueued per object, blocking Job queue
Suspected Cause
Search-cache indexing is designed to coalesce cache updates: it collects all objects touched within a single database transaction, a single SearchCacheJob covers the whole batch. This coalescing only works if multiple object saves share one transaction. It falls apart whenever each object save() is its own transaction - which is exactly what happens with ordinary non-bulk API writes (each request/save typically commits independently). A single-object transaction means every save gets its own SearchCacheJob.
This appears to be a regression introduced in NetBox 4.7.0: the same pattern of many sequential single-object writes did not previously result in one job per object.
Proposed Fix
No response
Source: netbox-community/netbox