mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
@@ -113,7 +113,14 @@ export default (ctx: TenantContext) => ({
|
||||
},
|
||||
}).then(primeStoriesFromConnection(ctx)),
|
||||
debugScrapeMetadata: new DataLoader(
|
||||
createManyBatchLoadFn((url: string) => scraper.scrape(url)),
|
||||
createManyBatchLoadFn((url: string) =>
|
||||
// This typecast is needed because the custom `ms` format does not return
|
||||
// the desired `number` type even though that's the only type it can
|
||||
// output.
|
||||
scraper.scrape(url, (ctx.config.get(
|
||||
"scrape_timeout"
|
||||
) as unknown) as number)
|
||||
),
|
||||
{
|
||||
// Disable caching for the DataLoader if the Context is designed to be
|
||||
// long lived.
|
||||
|
||||
@@ -31,6 +31,7 @@ export const Stories = (ctx: TenantContext) => ({
|
||||
create(
|
||||
ctx.mongo,
|
||||
ctx.tenant,
|
||||
ctx.config,
|
||||
input.story.id,
|
||||
input.story.url,
|
||||
omitBy(input.story, isNull),
|
||||
@@ -72,5 +73,5 @@ export const Stories = (ctx: TenantContext) => ({
|
||||
remove: async (input: GQLRemoveStoryInput): Promise<Readonly<Story> | null> =>
|
||||
remove(ctx.mongo, ctx.tenant, input.id, input.includeComments),
|
||||
scrape: async (input: GQLScrapeStoryInput): Promise<Readonly<Story> | null> =>
|
||||
scrape(ctx.mongo, ctx.tenant.id, input.id),
|
||||
scrape(ctx.mongo, ctx.config, ctx.tenant.id, input.id),
|
||||
});
|
||||
|
||||
@@ -263,12 +263,11 @@ export function createSubscriptionServer(
|
||||
schema: GraphQLSchema,
|
||||
options: Options
|
||||
) {
|
||||
const keepAlive = options.config.get("websocket_keep_alive_timeout");
|
||||
if (typeof keepAlive !== "number" || keepAlive <= 0) {
|
||||
throw new Error(
|
||||
"expected the websocket_keep_alive_timeout configuration to be a positive number"
|
||||
);
|
||||
}
|
||||
// This typecast is needed because the custom `ms` format does not return the
|
||||
// desired `number` type even though that's the only type it can output.
|
||||
const keepAlive = (options.config.get(
|
||||
"websocket_keep_alive_timeout"
|
||||
) as unknown) as number;
|
||||
|
||||
return SubscriptionServer.create(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user