[PR #20783] [MERGED] Fixes #20660: Optimize loading of custom script modules from remote storage #16050

Closed
opened 2025-12-30 00:25:31 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20783
Author: @jeremystretch
Created: 11/10/2025
Status: Merged
Merged: 11/11/2025
Merged by: @jnovinger

Base: mainHead: 20660-script-loading-time


📝 Commits (1)

  • 54bc239 Fixes #20660: Optimize loading of custom script modules from remote storage

📊 Changes

2 files changed (+2 additions, -3 deletions)

View changed files

📝 netbox/extras/models/mixins.py (+1 -2)
📝 netbox/extras/models/scripts.py (+1 -1)

📄 Description

Fixes: #20660

  • Tweak exec_module() to avoid forcing the creation of a new storage connection on each call
  • Convert module_scripts to a cached property, to avoid triggering a new fetch for each script within a module file

Some quick testing using three modules comprising five total scripts shows total rendering time for the script list view reduced from ~4.15s to ~0.80s. There is still some linear increment per script module, as each file must be fetched from remote storage, but it should be greatly reduced.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20783 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 11/10/2025 **Status:** ✅ Merged **Merged:** 11/11/2025 **Merged by:** [@jnovinger](https://github.com/jnovinger) **Base:** `main` ← **Head:** `20660-script-loading-time` --- ### 📝 Commits (1) - [`54bc239`](https://github.com/netbox-community/netbox/commit/54bc23939b894936f1ecee4c65211ee7faab5158) Fixes #20660: Optimize loading of custom script modules from remote storage ### 📊 Changes **2 files changed** (+2 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/models/mixins.py` (+1 -2) 📝 `netbox/extras/models/scripts.py` (+1 -1) </details> ### 📄 Description ### Fixes: #20660 - Tweak `exec_module()` to avoid forcing the creation of a new storage connection on each call - Convert `module_scripts` to a cached property, to avoid triggering a new fetch for each script within a module file Some quick testing using three modules comprising five total scripts shows total rendering time for the script list view reduced from ~4.15s to ~0.80s. There is still some linear increment per script module, as each file must be fetched from remote storage, but it should be greatly reduced. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:25:31 +01:00
adam closed this issue 2025-12-30 00:25:31 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16050