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

Massive speedup in executing startup_scripts #207

Merged
merged 1 commit into from
Dec 16, 2019

Conversation

cimnine
Copy link
Collaborator

@cimnine cimnine commented Dec 14, 2019

The changes in this PR result in a massively reduced execution time of the startup_scripts.
What used to take minutes now takes seconds. This increases the startup time of a Netbox Docker container drastically.

The bottleneck was that ./manage.py shell was run for every file in the startup_scripts folder.
This command takes a while to load, because it has to initialize the whole Django context.

The new solution is that ./manage.py shell is only loaded once. It is given a piece of python code that loads the startup_scripts/__main__.py file. This file contains the remaining code to execute all the startup scripts in the right order.

@cimnine cimnine added this to the 0.16.0 milestone Dec 14, 2019
@cimnine cimnine requested a review from tobiasge December 14, 2019 17:29
@cimnine cimnine added the enhancement The issue describes an enhancement that we would like to implement in the future. label Dec 14, 2019
Copy link
Member

@tobiasge tobiasge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the speed with this. 👍

@cimnine cimnine merged commit b48de9f into develop Dec 16, 2019
@cimnine cimnine deleted the speedup_startup_scripts branch December 16, 2019 11:17
@cimnine cimnine mentioned this pull request Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue describes an enhancement that we would like to implement in the future.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants