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

Simplify deleteFeed #403

Merged
merged 3 commits into from
Nov 8, 2022
Merged
Changes from 1 commit
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
23 changes: 7 additions & 16 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,24 +757,15 @@ exports.init = function (sbot, config) {
() => {
if (!state.has(feedId)) return cb()

self.query(
where(author(feedId)),
asOffsets(),
toCallback((err, offsets) => {
pull(
self.query(where(author(feedId)), asOffsets(), toPullStream()),
pull.asyncMap(log.del),
pull.collect((err) => {
arj03 marked this conversation as resolved.
Show resolved Hide resolved
// prettier-ignore
if (err) return cb(clarify(err, 'deleteFeed() failed to query jitdb for ' + feedId))
if (err) return cb(clarify(err, 'deleteFeed() failed for feed ' + feedId))

push(
push.values(offsets),
push.asyncMap(log.del),
push.collect((err) => {
// prettier-ignore
if (err) return cb(clarify(err, 'deleteFeed() failed for feed ' + feedId))

state.delete(feedId)
indexes.base.removeFeedFromLatest(feedId, cb)
})
)
state.delete(feedId)
indexes.base.removeFeedFromLatest(feedId, cb)
})
)
}
Expand Down