Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ssb-db2 and ssb-meta-feeds #7

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
author,
descending,
paginate,
batch,
live,
toPullStream,
toCallback,
Expand Down Expand Up @@ -41,7 +42,7 @@ exports.init = function init(sbot) {
sbot.metafeeds.findOrCreate(
mf,
(f) => f.feedpurpose === 'indexes',
{ feedpurpose: 'indexes', feedformat: 'bendy butt' },
{ feedpurpose: 'indexes', feedformat: 'bendybutt-v1' },
(err, indexesMF) => {
if (err) return reject(err)
else resolve(indexesMF)
Expand Down Expand Up @@ -116,14 +117,10 @@ exports.init = function init(sbot) {
const matchesQuery = QL0.toOperator(queryQL0)
return cat([
// Old
pull(
sbot.db.query(
where(and(matchesQuery, gt(latestSequence, 'sequence'))),
paginate(50),
toPullStream()
),
pull.map(pull.values),
pull.flatten()
sbot.db.query(
where(and(matchesQuery, gt(latestSequence, 'sequence'))),
batch(75),
mycognosist marked this conversation as resolved.
Show resolved Hide resolved
toPullStream()
),
// Live
sbot.db.query(where(matchesQuery), live(), toPullStream()),
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"dependencies": {
"pull-cat": "^1.1.11",
"pull-stream": "^3.6.14",
"ssb-db2": "github:ssb-ngi-pointer/ssb-db2#publishAs-simple",
"ssb-db2": "github:ssb-ngi-pointer/ssb-db2#support-bendy-butt",
"ssb-subset-ql": "~0.2.0"
},
"peerDependencies": {
"ssb-meta-feeds": "~0.15.0"
"ssb-meta-feeds": ">=0.18.0"
},
"devDependencies": {
"husky": "^4.3.0",
Expand All @@ -31,7 +31,7 @@
"ssb-caps": "^1.1.0",
"ssb-fixtures": "^2.4.1",
"ssb-keys": "^8.2.0",
"ssb-meta-feeds": "~0.15.0",
"ssb-meta-feeds": "~0.18.0",
"tap-bail": "^1.0.0",
"tap-spec": "^5.0.0",
"tape": "^5.2.2"
Expand Down
5 changes: 4 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ test('update index feed for votes a bit', (t) => {
})

// Make it slow so we can cancel in between
let stopped = false
const PERIOD = 200
const originalPublishAs = sbot.db.publishAs
sbot.db.publishAs = function (keys, content, cb) {
setTimeout(() => {
if (stopped) return
originalPublishAs.call(sbot.db, keys, content, cb)
}, PERIOD)
}
Expand All @@ -114,9 +116,10 @@ test('update index feed for votes a bit', (t) => {

setTimeout(() => {
sbot.indexFeedWriter.stop({ author: sbot.id, type: 'vote' })
stopped = true
t.pass('stopped task')
sbot.close(true, t.end)
}, PERIOD * 3.75)
}, PERIOD * 3.5)
}
)
})
Expand Down