dominictarr / npmd

MIT License
449 stars 37 forks source link

Sync hangs, and sync verbose crashes #59

Open drpepper opened 10 years ago

drpepper commented 10 years ago

When I run --sync, it hangs at 100%

|....:....|....:....|....:....|....:....|....:....| 100.0% 

And when I run --sync --verbose:

$ npmd --sync --verbose
syncing...

undefined:1
[object Object]
 ^
SyntaxError: Unexpected token o
    at Object.parse (native)
    at /usr/local/lib/node_modules/npmd/plugins/couch-sync.js:106:24
    at Object.hook (/usr/local/lib/node_modules/npmd/node_modules/level-sublevel/sub.js:233:5)
    at /usr/local/lib/node_modules/npmd/node_modules/level-sublevel/node_modules/level-hooks/index.js:62:29
    at Array.forEach (native)
    at each (/usr/local/lib/node_modules/npmd/node_modules/level-sublevel/node_modules/level-hooks/index.js:61:17)
    at Array.forEach (native)
    at LevelUP.onBatch (/usr/local/lib/node_modules/npmd/node_modules/level-sublevel/node_modules/level-hooks/index.js:74:9)
    at LevelUP.EventEmitter.emit (events.js:95:17)
    at /usr/local/lib/node_modules/npmd/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/levelup.js:349:12

I'm on OSX 10.9.1, node v0.10.22.

dominictarr commented 10 years ago

That isn't hanging, it's still connected and getting updates live.

Hmm, what could be changed to make that more obvious?

Unfortunately, I don't have time to work on this right now, but when I do I'll investigate --verbose mode.

drpepper commented 10 years ago

Oh, ok. So it's npmd --sync that we're supposed to be running in the background? Just updating the README would help to understand that. Another possibility would be to add a flag like --sync-once that quits when it reaches 100% .

Another idea: when it reaches 100% you could write something like "Waiting for more updates..." on the next line.

dominictarr commented 10 years ago

Ah, got it. Okay, I've fixed the readme. thanks for your feedback, this has been a really hard "bug" to diagnose, I've answered lots of issues where someone has gotten the wrong impression about this feature. I think we got it now though!

npmd sync (without -- also works) recovers if it crashes, so you can just stop it when you get to 100 and use the data that is already in the database.

zeke commented 10 years ago

I try installing npmd every month or so, and the npmd sync step never seems to work/finish. Here's what it does today:

$ which npmd
/Users/zeke/.nvm/v0.10.26/bin/npmd
$ npmd -v
0.20.2
$ npmd sync
connected to npm registry!!!

|....:....|....:....|....:....|....:....|....:....| 0.0%   

^ twenty minutes later, still at 0.0%
dominictarr commented 10 years ago

some npm stuff has changed because of the recent changes to how the npm registry works. I just pushed 0.20.3 can you try that?

hopefully I'll get time to work on this again soon!

zeke commented 10 years ago

So far so good. Thanks!

dominictarr commented 10 years ago

awesome!