Skip to content

Conversation

@delvedor
Copy link
Member

With this PR we introduce a new queue to handle the shutdown procedure, following the avvio style!

  • Use onClose to add new functions to execute.
  • Use close to start the process

Related: fastify/fastify#123

Feedbacks?

@delvedor delvedor requested a review from mcollina July 10, 2017 14:05
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

We should also expose this if an instance is passed in.

Boot.prototype.onClose = function (func) {
this._closeQ.push(func, err => {
if (err) this._error = err
})
Copy link
Member

Choose a reason for hiding this comment

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

I think we should call unshift() here. More or less, the latest you register a shutdown part, the sooner it will be executed. This is the inverse of the start phase.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

The close bit on the instance might need a unit test.
Apart from this, LGTM as semver-major.

@delvedor
Copy link
Member Author

LGTM as semver-major.

Why semver major?
I don't see a breaking change here.

@mcollina
Copy link
Member

adding the new properties to the instance is.

@delvedor
Copy link
Member Author

Ok I got you, it is not a major change for avvio itself, but it is for the apps that are using it 👍

@delvedor delvedor merged commit 52b579f into master Jul 10, 2017
@delvedor delvedor deleted the close-queue branch July 10, 2017 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants