Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache /api/schema/ endpoint #15894

Closed
mulmat opened this issue Apr 30, 2024 · 2 comments · Fixed by #15897
Closed

Cache /api/schema/ endpoint #15894

mulmat opened this issue Apr 30, 2024 · 2 comments · Fixed by #15897
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@mulmat
Copy link
Contributor

mulmat commented Apr 30, 2024

NetBox version

v3.7.6

Feature type

Change to existing functionality

Proposed functionality

Add caching on the /api/schema/ endpoint with a sane default (maybe 300 seconds?) and with the possibility to configure it in configuration.py

Use case

Generating openapi schema takes some time, caching it would:

  • Decrease response time when doing multiple calls to /api/schema/
  • Lower the resources needed from application server (since less openapi schemas will be generated)

Database changes

None

External dependencies

None

@mulmat mulmat added status: needs triage This issue is awaiting triage by a maintainer type: feature Introduction of new functionality to the application labels Apr 30, 2024
@mulmat
Copy link
Contributor Author

mulmat commented Apr 30, 2024

I can own this if accepted

@jeremystretch
Copy link
Member

We actually used to cache the schema definition back in ~v2.11 (see #6423 and 257c0af), before we switched from drf-yasg to spectacular. Unfortunately I don't think spectacular offers caching support natively, so we'd have to implement it ourselves.

@mulmat happy to assign this to you to explore options. Let us know what you find!

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs triage This issue is awaiting triage by a maintainer labels Apr 30, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants