Reduce auth timeout

This commit is contained in:
Jon Staab
2024-09-05 15:42:58 -07:00
parent 8e6423f488
commit 3868daa04e
3 changed files with 5 additions and 2 deletions
+2
View File
@@ -11,6 +11,7 @@ import type {Router} from './router'
export type AppContext = {
router: Router
requestDelay: number
authTimeout: number
requestTimeout: number
dufflepudUrl?: string
}
@@ -41,6 +42,7 @@ export const getDefaultNetContext = (overrides: Partial<NetContext> = {}) => ({
export const getDefaultAppContext = (overrides: Partial<AppContext> = {}) => ({
router: makeRouter(),
requestDelay: 50,
authTimeout: 300,
requestTimeout: 3000,
...overrides,
})
+2 -1
View File
@@ -42,7 +42,8 @@ export const subscribe = (request: PartialSubscribeRequest) => {
// Make sure to query our local relay too
const delay = ctx.app.requestDelay
const timeout = ctx.app.requestTimeout
const sub = baseSubscribe({delay, authTimeout: timeout, relays: [], ...request})
const authTimeout = ctx.app.authTimeout
const sub = baseSubscribe({delay, timeout, authTimeout, relays: [], ...request})
sub.emitter.on("event", (url: string, e: TrustedEvent) => {
repository.publish(e)
+1 -1
View File
@@ -41,7 +41,7 @@ export class Tags extends (Fluent<Tag> as OmitStatics<typeof Fluent<Tag>, 'from'
static wrap = (p: Iterable<string[]>) => new Tags(Array.from(p).map(Tag.from))
static fromEvent = (event: {tags: string[][]}) => Tags.wrap(event.tags || [])
static fromEvent = (event: {tags: string[][]}) => Tags.wrap(event?.tags || [])
static fromEvents = (events: {tags: string[][]}[]) => Tags.wrap(events.flatMap(e => e.tags || []))