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

Reload fields depends on config even when config updated in another node #451

Merged
merged 1 commit into from
Jun 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/crowi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ Crowi.prototype.setupConfigPubSub = function() {
debug('PubSubId', this.pubSubId)

if (this.subscriber) {
this.subscriber.on('message', (channel, message) => {
this.subscriber.on('message', async (channel, message) => {
if (channel !== this.configPubSubChannel) return
const { pubSubId, config } = JSON.parse(message)
if (pubSubId === this.pubSubId) return
this.config = config
await Promise.all([this.setupSlack(), this.setupMailer()])
Copy link
Member Author

Choose a reason for hiding this comment

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

[note] I thought that it's bit difficult to detect what instances to reload by difference from current config. Also it will confuse someone reading this.
This is why of adding this only.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also I checked that there are no problem to call setupSlack and setupMailer always.

debug(`Config updated by ${pubSubId}`)
})

Expand Down