@@ -36,9 +36,11 @@ async function main() {
36
36
// after a bootstrap is done, it's moved to main (with settings)
37
37
// if it was already finished, we will set the settings on the main index
38
38
await bootstrap ( await stateManager . check ( ) ) ;
39
+
39
40
// then we figure out which updates we missed since
40
41
// the last time main index was updated
41
42
await replicate ( await stateManager . get ( ) ) ;
43
+
42
44
// then we watch 👀 for all changes happening in the ecosystem
43
45
return watch ( await stateManager . get ( ) ) ;
44
46
}
@@ -89,6 +91,10 @@ function infoDocs(offset, nbDocs, emoji) {
89
91
}
90
92
91
93
async function bootstrap ( state ) {
94
+ await stateManager . save ( {
95
+ stage : 'watch' ,
96
+ } ) ;
97
+
92
98
if ( state . seq > 0 && state . bootstrapDone === true ) {
93
99
await setSettings ( mainIndex ) ;
94
100
log . info ( '⛷ Bootstrap: done' ) ;
@@ -167,6 +173,10 @@ async function replicate({ seq }) {
167
173
seq
168
174
) ;
169
175
176
+ await stateManager . save ( {
177
+ stage : 'replicate' ,
178
+ } ) ;
179
+
170
180
const { seq : npmSeqToReach } = await npm . info ( ) ;
171
181
172
182
return new Promise ( ( resolve , reject ) => {
@@ -213,11 +223,15 @@ async function replicate({ seq }) {
213
223
} ) ;
214
224
}
215
225
216
- function watch ( { seq } ) {
226
+ async function watch ( { seq } ) {
217
227
log . info (
218
228
`🛰 Watch: 👍 We are in sync (or almost). Will now be 🔭 watching for registry updates, since ${ seq } `
219
229
) ;
220
230
231
+ await stateManager . save ( {
232
+ stage : 'watch' ,
233
+ } ) ;
234
+
221
235
return new Promise ( ( resolve , reject ) => {
222
236
const changes = db . changes ( {
223
237
...defaultOptions ,
0 commit comments