Skip to content

Cached REST API spec introduced in #6423 is stale after updates #9122

@fabi125

Description

@fabi125

NetBox version

v3.1.11

Python version

3.8

Steps to Reproduce

  1. Install Netbox v3.0.5+
  2. Fetch http://netbox/api/docs/?format=openapi to populate Redis cache
  3. Update to another Netbox version.
  4. Fetch http://netbox/api/docs/?format=openapi and get the old openapi definition

Expected Behavior

The correct openapi definition should be returned.

Observed Behavior

Stale cached version of the openapi definition is returned.

Honestly I'm not 100% sure why this is happening. My reading of the Django cache documentation (https://docs.djangoproject.com/en/4.0/topics/cache/ and https://docs.djangoproject.com/en/4.0/ref/settings/#std:setting-CACHES-KEY_FUNCTION) makes it sound like the cache should use the Netbox version as a key, which would make it a different entry in the cache so this shouldn't be a problem.

Hopefully someone with more knowledge about Django caching can reproduce this and figure out why this is happening.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions