Monday, April 5, 2010

Forked for node.js 0.1.33

‹prev | My Chain | next›

With node.couch.js mostly working in node.js version 0.1.33, I fork it on github so that others might use it. Recall that node.couch.js is a node.js library for watching the changes feed that CouchDB exposes.

I had not expected to be making any changes to the code, so I have been making changes in the cloned repository. To get my changes into my forked repository, I move the original repository to a backup location and make a patch:
cstrom@whitefall:~$ cd repos
cstrom@whitefall:~/repos$ mv node.couch.js node.couch.js.bak
cstrom@whitefall:~/repos$ cd !$
cd node.couch.js.bak
cstrom@whitefall:~/repos/node.couch.js.bak$ git diff --no-prefix > ../v0133.patch
With that, I clone my forked copy of node.couch.js and apply my patch:
cstrom@whitefall:~/repos/node.couch.js.bak$ cd -
cstrom@whitefall:~/repos$ git clone
Initialized empty Git repository in /home/cstrom/repos/node.couch.js/.git/
cstrom@whitefall:~/repos/node.couch.js$ patch -p0 < ../v0133.patch
patching file changes/lib/listener.js
patching file changes/lib/service.js
After a few more clean-up things, I am ready to test it out. I start up my service, wait for a bit, then make change:
cstrom@whitefall:~/repos/node.couch.js/changes$ node ./lib/service.js http://localhost:5984


Hmmmm... That is not quite what I expected. The delay was purely by accident. Did that suppress the change or did I go a bit too far in my code cleanup? Let's try again, making the change almost immediately after starting the node.couch.js service:
cstrom@whitefall:~/repos/node.couch.js/changes$ node ./lib/service.js http://localhost:5984
Ah, that is more like it.

But what is the deal with the second output and the "last_seq" output above? I eventually track the second change output down to a print-stderr debug statement that I left in there (commit removing it). After clearing that out, my output now looks like:
cstrom@whitefall:~/repos/node.couch.js/changes$ node ./lib/service.js http://localhost:5984
I am unable to track down the source of the "last_seq" output. Once I get it, no more changes are received and / or processed by node.couch.js. I will continue investigating that tomorrow.

Day #64

No comments:

Post a Comment