Fix unfurl timeout
This commit is contained in:
parent
b9fc663db4
commit
54481ab96b
|
@ -217,7 +217,10 @@ interface PreviewCard {
|
||||||
async function unfurlCard(url: string): Promise<PreviewCard | null> {
|
async function unfurlCard(url: string): Promise<PreviewCard | null> {
|
||||||
console.log(`Unfurling ${url}...`);
|
console.log(`Unfurling ${url}...`);
|
||||||
try {
|
try {
|
||||||
const result = await unfurl(url, { fetch, follow: 2, timeout: Time.seconds(1), size: 1024 * 1024 });
|
const result = await unfurl(url, {
|
||||||
|
fetch: (url) => fetch(url, { signal: AbortSignal.timeout(Time.seconds(1)) }),
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: result.oEmbed?.type || 'link',
|
type: result.oEmbed?.type || 'link',
|
||||||
url: result.canonical_url || url,
|
url: result.canonical_url || url,
|
||||||
|
|
Loading…
Reference in New Issue