kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Startup time improvements

Open rtibbles opened this issue 3 years ago • 3 comments

Summary

  • Limit imports of pkg_resources to defer a costly import
  • Move code out of module scope and into the core app ready method
  • Defer actual registration of zeroconf to the RUN event so that it doesn't block SERVING
  • Default the no_input kwarg of initialize to True - this will not effect cli invocations that provide their own default value, but will help apps that are calling the initialize function and which are running in no_input contexts.

In all, these changes seemed to give approximately a 60-70% reduction in time taken from first start to being ready to serve HTTP requests.


Testing checklist

  • [x] Contributor has fully tested the PR manually
  • [ ] If there are any front-end changes, before/after screenshots are included
  • [ ] Critical user journeys are covered by Gherkin stories
  • [x] Critical and brittle code paths are covered by unit tests

PR process

  • [x] PR has the correct target branch and milestone
  • [x] PR has 'needs review' or 'work-in-progress' label
  • [x] If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • [ ] If this is an important user-facing change, PR or related issue has a 'changelog' label
  • [ ] If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

rtibbles avatar Aug 31 '22 21:08 rtibbles

Irritatingly, a change in here seems to be breaking the Mac App build. Will investigate further before we merge this.

rtibbles avatar Sep 09 '22 17:09 rtibbles

DMG build failure appears to be unrelated to these changes. Tracked separately: https://github.com/learningequality/kolibri-app/issues/105

rtibbles avatar Sep 22 '22 14:09 rtibbles