Disable negentropy in sync temporarily
This commit is contained in:
parent
c5403f786f
commit
518a312972
1 changed files with 23 additions and 22 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import {page} from "$app/stores"
|
import {page} from "$app/stores"
|
||||||
import type {Unsubscriber} from "svelte/store"
|
import type {Unsubscriber} from "svelte/store"
|
||||||
import {last, call, assoc, chunk, WEEK, ago} from "@welshman/lib"
|
import {last, call, assoc, WEEK, ago} from "@welshman/lib"
|
||||||
import {merged} from "@welshman/store"
|
import {merged} from "@welshman/store"
|
||||||
import {
|
import {
|
||||||
getListTags,
|
getListTags,
|
||||||
|
|
@ -25,7 +25,7 @@ import {
|
||||||
unionFilters,
|
unionFilters,
|
||||||
} from "@welshman/util"
|
} from "@welshman/util"
|
||||||
import type {Filter, List, PublishedList, TrustedEvent} from "@welshman/util"
|
import type {Filter, List, PublishedList, TrustedEvent} from "@welshman/util"
|
||||||
import {request, requestOne, Difference, DifferenceEvent} from "@welshman/net"
|
import {request} from "@welshman/net"
|
||||||
import {
|
import {
|
||||||
pubkey,
|
pubkey,
|
||||||
loadRelay,
|
loadRelay,
|
||||||
|
|
@ -42,7 +42,6 @@ import {
|
||||||
getFollows,
|
getFollows,
|
||||||
repository,
|
repository,
|
||||||
shouldUnwrap,
|
shouldUnwrap,
|
||||||
hasNegentropy,
|
|
||||||
} from "@welshman/app"
|
} from "@welshman/app"
|
||||||
import {REACTION_KINDS, CONTENT_KINDS, makeCommentFilter} from "@app/content"
|
import {REACTION_KINDS, CONTENT_KINDS, makeCommentFilter} from "@app/content"
|
||||||
import {INDEXER_RELAYS, PLATFORM_RELAYS} from "@app/env"
|
import {INDEXER_RELAYS, PLATFORM_RELAYS} from "@app/env"
|
||||||
|
|
@ -87,29 +86,31 @@ const pullOneWithFallback = async (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldFallback =
|
// Temporarily disable negentropy until the new welshman lands, which fixes
|
||||||
!hasNegentropy(url) ||
|
// error handling (neg-err with auth-required were never getting retried)
|
||||||
(await new Promise(resolve => {
|
const shouldFallback = true
|
||||||
if (signal.aborted) {
|
// !hasNegentropy(url) ||
|
||||||
resolve(false)
|
// (await new Promise(resolve => {
|
||||||
return
|
// if (signal.aborted) {
|
||||||
}
|
// resolve(false)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
// If teardown wins while the diff is opening, skip the fallback path and let cleanup stay in control.
|
// // If teardown wins while the diff is opening, skip the fallback path and let cleanup stay in control.
|
||||||
const diff = new Difference({relay: url, filter, events: cachedEvents, signal})
|
// const diff = new Difference({relay: url, filter, events: cachedEvents, signal})
|
||||||
|
|
||||||
diff.on(DifferenceEvent.Error, () => {
|
// diff.on(DifferenceEvent.Error, () => {
|
||||||
resolve(true)
|
// resolve(true)
|
||||||
})
|
// })
|
||||||
|
|
||||||
diff.on(DifferenceEvent.Close, () => {
|
// diff.on(DifferenceEvent.Close, () => {
|
||||||
for (const ids of chunk(100, Array.from(diff.need))) {
|
// for (const ids of chunk(100, Array.from(diff.need))) {
|
||||||
requestOne({relay: url, signal, autoClose: true, filters: [{ids}], onEvent})
|
// requestOne({relay: url, signal, autoClose: true, filters: [{ids}], onEvent})
|
||||||
}
|
// }
|
||||||
|
|
||||||
resolve(false)
|
// resolve(false)
|
||||||
})
|
// })
|
||||||
}))
|
// }))
|
||||||
|
|
||||||
if (shouldFallback && !signal.aborted) {
|
if (shouldFallback && !signal.aborted) {
|
||||||
request({relays: [url], signal, autoClose: true, filters: [{since, ...filter}], onEvent})
|
request({relays: [url], signal, autoClose: true, filters: [{since, ...filter}], onEvent})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue