Skip to content

Defer updates to the global search cache until after a response has been sent #21326

@jeremystretch

Description

@jeremystretch

NetBox Version

v4.5.1

Python Version

3.12

Area(s) of Concern

  • User Interface
  • REST API
  • GraphQL API
  • Python ORM
  • Other

Details

Currently, when an object with search capability is created, modified, or deleted, updates to the global search cache happen in sync with that operation (triggered by the post_save signal). This adds a small delay before a response can be returned.

As updates to the search cache are not considered part of the critical path, we can safely defer these operations to a background task to be completed immediately after the request has been processed. This can be accomplished by modifying the the search backend's caching_handler() and removal_handler() methods to enqueue a background task which calls cache() and remove() (respectively), rather than calling those methods directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions