Enqueue context requests to reduce concurrent subscriptions in feeds

This commit is contained in:
Jonathan Staab 2023-04-17 17:15:41 -05:00
parent 879ece60a9
commit eaa517d71a
6 changed files with 15 additions and 21 deletions

View File

@ -2,22 +2,10 @@
- [ ] Claim relays bounty
- [ ] Add real search, it's a big hurdle for first-timers/anons
- [ ] Fix notifications
- [ ] Queue context requests to avoid having too many concurrent subscriptions
- [ ] Advanced search
- Select timeframe, authors, p tags, t tags
- [ ] Some lnurls aren't working npub1y3k2nheva29y9ej8a22e07epuxrn04rvgy28wvs54y57j7vsxxuq0gvp4j
- [ ] Global search modal that searches within current feed
- [ ] Fix force relays on login: http://localhost:5173/messages/npub1l66wvfm7dxhd6wmvpukpjpyhvwtlxzu0qqajqxjfpr4rlfa8hl5qlkfr3q
- [ ] Remember message/chat status
- [ ] Image classification
- https://github.com/bhky/opennsfw2
# Custom views
- [ ] Add customize icon and route with editable custom view cards using "lists" nip
- nevent1qqspjcqw2hu5gfcpkrjhs0aqvxuzjgtp50l375mcqjfpmk48cg5hevgpr3mhxue69uhkummnw3ez6un9d3shjtnhd3m8xtnnwpskxegpzamhxue69uhkummnw3ezuendwsh8w6t69e3xj7spramhxue69uhkummnw3ez6un9d3shjtnwdahxxefwv93kzer9d4usz9rhwden5te0wfjkccte9ejxzmt4wvhxjmcpr9mhxue69uhkummnw3ezuer9d3hjuum0ve68wctjv5n8hwfg
- [ ] Custom views should combine pubkeys, relays, event ids, and topics
# Core
- [ ] Make mutes private
@ -59,11 +47,11 @@
# UI/Features
- [ ] Remember message/chat status
- [ ] Allow sharing of lists/following other people's lists
- [ ] Add suggestion list for topics on compose
- [ ] Badges link to https://badges.page/p/97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322
- [ ] Add QR code that pre-fills follows and relays for a new user
- [ ] Advanced search: select timeframe, authors, p tags, t tags
- If logged in, open a detail page that shows the relays and people
- If not logged in, pre-populate follows/relays in onboarding flow
- [ ] If someone logs in with their private key, create a notification to install an extension

View File

@ -195,8 +195,8 @@ export const dropAll = () => new Promise(resolve => loki.deleteDatabase(resolve)
// ----------------------------------------------------------------------------
// Domain-specific collections
const sortByCreatedAt = sortBy(prop("created_at"))
const sortByLastSeen = sortBy(prop("last_seen"))
const sortByCreatedAt = sortBy(e => -e.created_at)
const sortByLastSeen = sortBy(e => -e.last_seen)
export const people = new Table("people", "pubkey", {
max: 5000,

View File

@ -101,12 +101,16 @@
notes = uniqBy(prop("id"), notes.concat(bottom))
}
let p = Promise.resolve()
const loadMore = async () => {
// Wait for this page to load before trying again
await network.load({
relays: feedRelay ? [feedRelay] : relays,
filter: mergeFilter(filter, cursor.getFilter()),
onChunk,
onChunk: chunk => {
p = p.then(() => onChunk(chunk))
},
})
// Update our cursor
@ -117,7 +121,9 @@
const sub = network.listen({
relays,
filter: mergeFilter(filter, {since}),
onChunk,
onChunk: chunk => {
p = p.then(() => onChunk(chunk))
},
})
const scroller = createScroller(loadMore, {element: getModal()})

View File

@ -178,7 +178,7 @@ export const listen = async pubkey => {
;(listen as any)._listener?.unsub()
;(listen as any)._listener = await network.listen({
delay: 5000,
delay: 3000,
relays: getUserReadRelays(),
filter: [
{kinds: [1, 4], authors: [pubkey], since},

View File

@ -14,7 +14,7 @@
const {lists} = user
const label = item.type === "p" ? "person" : "topic"
const modifyList = updateIn("tags", tags => tags.concat([[item.type, item.value]]))
const modifyList = updateIn("tags", tags => (tags || []).concat([[item.type, item.value]]))
const selectlist = list => {
modal.replace({type: "list/edit", list: modifyList(list)})

View File

@ -48,7 +48,7 @@ export const openModals = writable(0)
export const modal = {
stack: new WritableList([]) as WritableList<any>,
sync: ($stack, opts = null) => {
sync: ($stack, opts = {}) => {
const hash = $stack.length > 0 ? `#m=${$stack.length}` : ""
navigate(window.location.pathname + hash, opts)