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

Question/Bug: Init Order #1210

Closed
lgenet opened this Issue Jan 30, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@lgenet
Contributor

lgenet commented Jan 30, 2017

Description:
This is more so a question that I am very confused by than an out-right bug/issue. The init stack is as follows.

            util.wrapTimedTask(this, this.initModules, 'initModules'),
            util.wrapTimedTask(this, this.initRequestHandler, 'initRequestHandler'),
            util.wrapTimedTask(this, this.initDBConnections, 'initDBConnections'),
            util.wrapTimedTask(this, this.initDBIndices, 'initDBIndices'),
            util.wrapTimedTask(this, this.initServerRegistration, 'initServerRegistration'),
            util.wrapTimedTask(this, this.initCommandService, 'initCommandService'),
            util.wrapTimedTask(this, this.initSiteMigration, 'initSiteMigration'),
            util.wrapTimedTask(this, this.initSessions, 'initSessions'),
            util.wrapTimedTask(this, this.initPlugins, 'initPlugins'),
            util.wrapTimedTask(this, this.initSites, 'initSites'),
            util.wrapTimedTask(this, this.initLocales, 'initLocales'),
            util.wrapTimedTask(this, this.initLibraries, 'initLibraries'),
            util.wrapTimedTask(this, this.registerMetrics, 'registerMetrics'),
            util.wrapTimedTask(this, this.initServer, 'initServer')

So, the initServer is the very last thing that runs in the stack. Inside of InitServer is when the Middleware stack is built out. This is after the plugin's get a chance to run their "onStartupWithContext" functions. In your example code, you suggest swapping out middleware in these blocks. However, I do not have access to the middleware set at this point.

Was this the intent? Based on your blog post (https://gist.github.com/brianhyder/f011cdea8a6cce1128ba6ff86e9a10a1#file-minify-js) with examples of using the new feature I would say that it is not. Thus I am wondering if I am missing something.

Steps to Reproduce:
N/A

Configuration Details:
Multisite, running locally.

Log Output:
N/A

PencilBlue Version: 0.8.0

Node.js Version: 4.2.2

Environment Description: OSX

@brianhyder brianhyder self-assigned this Feb 1, 2017

@brianhyder brianhyder added the bug label Feb 1, 2017

@brianhyder brianhyder added this to the 0.8.1 milestone Feb 1, 2017

@brianhyder

This comment has been minimized.

Show comment
Hide comment
@brianhyder

brianhyder Feb 1, 2017

Member

@lgenet You are correct. PR coming shortly

Member

brianhyder commented Feb 1, 2017

@lgenet You are correct. PR coming shortly

brianhyder added a commit that referenced this issue Feb 1, 2017

@brianhyder brianhyder closed this in #1212 Feb 1, 2017

@brianhyder brianhyder removed the in progress label Feb 1, 2017

brianhyder added a commit that referenced this issue Feb 1, 2017

Merge pull request #1212 from pencilblue/issue/1210
#1210 Fixes issue where middleware is not registered before plugins a…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment