-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat(settings): allow to make a PR which changes both the settings and the data #179
Changes from all commits
b903278
4cf4846
0675e8e
9d1dc6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ const { index: mainIndex, client } = createAlgoliaIndex(c.indexName); | |
const { index: bootstrapIndex } = createAlgoliaIndex(c.bootstrapIndexName); | ||
const stateManager = createStateManager(mainIndex); | ||
|
||
setSettings(mainIndex) | ||
Promise.resolve() | ||
.then(() => setSettings(bootstrapIndex)) | ||
.then(() => stateManager.check()) | ||
.then(bootstrap) | ||
|
@@ -83,6 +83,7 @@ function infoDocs(offset, nbDocs, emoji) { | |
|
||
async function bootstrap(state) { | ||
if (state.seq > 0 && state.bootstrapDone === true) { | ||
await setSettings(mainIndex); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setSettings will always be called when bootstrap is done |
||
log.info('⛷ Bootstrap: done'); | ||
return state; | ||
} | ||
|
@@ -148,18 +149,11 @@ async function bootstrap(state) { | |
|
||
async function moveToProduction() { | ||
log.info('🚚 starting move to production'); | ||
await client.copyIndex(c.indexName, c.bootstrapIndexName, [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we no longer copy the settings from the prod index to the bootstrap index, but rely on the bootstrap index being correct |
||
'settings', | ||
'synonyms', | ||
'rules', | ||
]); | ||
|
||
const currentState = await stateManager.get(); | ||
await client.copyIndex(c.bootstrapIndexName, c.indexName); | ||
await stateManager.save(currentState); | ||
|
||
log.info('🗑 old bootstrap'); | ||
await client.deleteIndex(c.bootstrapIndexName); | ||
return stateManager.save(currentState); | ||
} | ||
|
||
async function replicate({ seq }) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only someone did a chore PR of moving to async/await... :D