Building a Real-time SMS Voting App Part 1: Node.js and CouchDB
twilio.com
twilio.com
I wrote this app to teach myself Node.js, CouchDB, Socket.io, HighCharts.js and bunch of other things that I really wanted to learn. I hope it's useful for people new to these things, and definitely appreciate all the feedback I'm getting from the community.
Scratch my comment above, the caching and flushing is introduced in a future blog post. In this iteration of the code base, an attempt is made to save a vote to the DB. If it fails, it fails, there is no attempt to retry.
https://github.com/crabasa/votr-part1/blob/master/events.js#...
A comment was made about whether the vote persistence would be considered ACID. Most likely not! Each vote that comes in fetches a copy of the event document. If votes came in fast enough, this would create a problem.
However, rather than corrupting the data, I think the votes would simply fails since CouchDB uses a revision property to prevent this:
http://wiki.apache.org/couchdb/Document_revisions?action=sho...