diff --git a/src/agent/network.ts b/src/agent/network.ts
index 6f953812..129aa2f3 100644
--- a/src/agent/network.ts
+++ b/src/agent/network.ts
@@ -37,7 +37,7 @@ const listen = ({relays, filter, onChunk = null, shouldProcess = true}) => {
})
}
-const load = ({relays, filter, onChunk = null, shouldProcess = true, timeout = 6000}) => {
+const load = ({relays, filter, onChunk = null, shouldProcess = true, timeout = 10_000}) => {
return new Promise(resolve => {
const now = Date.now()
const done = new Set()
diff --git a/src/util/misc.ts b/src/util/misc.ts
index 782b9356..feaeb81a 100644
--- a/src/util/misc.ts
+++ b/src/util/misc.ts
@@ -149,13 +149,15 @@ export const getLastSync = (k, fallback = 0) => {
export class Cursor {
until: number
limit: number
- constructor(limit = 50) {
+ constructor(limit = 10) {
this.until = now()
this.limit = limit
}
getFilter() {
return {
- until: this.until,
+ // Add a buffer so we can avoid blowing past the most relevant time interval
+ // (just now) until after a few paginations.
+ until: this.until + timedelta(3, 'hours'),
// since: this.until - timedelta(8, 'hours'),
limit: this.limit,
}
@@ -166,12 +168,13 @@ export class Cursor {
// There are various edge cases:
// - When we have zero events, there's nothing we can do, presumably we have everything.
// - Sometimes relays send us extremely old events. Use median to avoid too-large gaps
- if (events.length > 1) {
+ if (events.length > this.limit) {
const timestamps = sortBy(identity, pluck('created_at', events))
const gaps = aperture(2, timestamps).map(([a, b]) => b - a)
- const gap = quantile(gaps, 0.1)
+ const gap = quantile(gaps, 0.2)
- this.until -= Math.round(gap * events.length)
+ // Only paginate part of the way so we can avoid missing stuff
+ this.until -= Math.round(gap * events.length * 0.5)
}
}
}
diff --git a/src/views/notes/Feed.svelte b/src/views/notes/Feed.svelte
index 6c75dcaa..821c7148 100644
--- a/src/views/notes/Feed.svelte
+++ b/src/views/notes/Feed.svelte
@@ -52,7 +52,10 @@
})
// Show replies grouped by parent whenever possible
- return mergeParents(combined)
+ const merged = mergeParents(combined)
+
+ // Drop the oldest 20% of notes since we often get pretty old stuff
+ return merged.slice(0, Math.ceil(merged.length * 0.8))
}
const loadBufferedNotes = () => {
diff --git a/src/views/person/Likes.svelte b/src/views/person/Likes.svelte
index b642f0d2..87bb4402 100644
--- a/src/views/person/Likes.svelte
+++ b/src/views/person/Likes.svelte
@@ -10,5 +10,5 @@
const shouldDisplay = e => isLike(e.content)
-
+