Browse files

counting streams is depreciated, also dont worry about old

  • Loading branch information...
1 parent 2d24260 commit 21a4a0f8a82c797a69a3c8eb19163f8e86334db6 @dominictarr committed Feb 21, 2013
Showing with 13 additions and 7 deletions.
  1. +10 −2 index.js
  2. +3 −5 lib/db-opener.js
View
12 index.js
@@ -50,7 +50,10 @@ module.exports = function (db, id, schema) {
//a document that is modeled as a range of keys,
//rather than as a single {key: value} pair
+ //WHY DID I DO THIS? - remove this and it works.
+ //but it seems to be problem with r-array...
function checkOld (id, ts) {
+ return false
if(sources[id] && sources[id] >= ts) return true
sources[id] = ts
}
@@ -60,8 +63,8 @@ module.exports = function (db, id, schema) {
function save() {
if(!queued)
process.nextTick(function () {
- queued = false
db.batch(_batch)
+ queued = false
_batch = []
})
queued = true
@@ -78,8 +81,13 @@ module.exports = function (db, id, schema) {
var insertBatch =
db.scuttlebutt._insertBatch =
function (_id, doc_id, ts, value) {
+ ts = ts.toString()
+
+ //WTF WHY WAS THIS BEING TRIGGERED?
+ //if(checkOld(_id, ts)) return console.log('OLD', ts, value)
+ //if(checkOld(_id, ts))
+ // console.log('write-old', _id, ts)
- if(checkOld(_id, ts)) return
_batch.push({
key: bucket([doc_id, ts, _id]),
View
8 lib/db-opener.js
@@ -25,9 +25,7 @@ module.exports = function (db) {
emitter = doc_id
doc_id = emitter.name
}
- //it would be better to not count the 'HOME' stream,
- //and then dispose when the clone streams get it 0.
- emitter._streams ++
+
//read current state from db.
var opts = bucket.range([doc_id, 0, true], [doc_id, '\xff', true])
@@ -45,8 +43,8 @@ module.exports = function (db) {
var source = ary[2]
var change = JSON.parse(data.value)
- checkOld(source, ts)
-
+ //if(checkOld(source, ts))
+ // console.log('read-old', source, ts)
emitter._update([change, ts, source])
})

0 comments on commit 21a4a0f

Please sign in to comment.