tangled
alpha
login
or
join now
pds.ls
/
pdsls
399
fork
atom
atmosphere explorer
pds.ls
tool
typescript
atproto
399
fork
atom
overview
issues
1
pulls
pipelines
time out handle resolution http request
handle.invalid
1 month ago
5b6e2e65
5280dd5b
verified
This commit was signed with the committer's
known signature
.
handle.invalid
SSH Key Fingerprint:
SHA256:mBrT4x0JdzLpbVR95g1hjI1aaErfC02kmLRkPXwsYCk=
+5
-1
1 changed file
expand all
collapse all
unified
split
src
utils
api.ts
+5
-1
src/utils/api.ts
···
227
227
228
228
const tryResolve = async (
229
229
resolver: DohJsonHandleResolver | WellKnownHandleResolver,
230
230
+
timeoutMs: number = 5000,
230
231
): Promise<HandleResolveResult> => {
231
232
try {
232
232
-
const did = await resolver.resolve(handle);
233
233
+
const timeoutPromise = new Promise<never>((_, reject) =>
234
234
+
setTimeout(() => reject(new Error("Request timed out")), timeoutMs),
235
235
+
);
236
236
+
const did = await Promise.race([resolver.resolve(handle), timeoutPromise]);
233
237
return { success: true, did };
234
238
} catch (err: any) {
235
239
return { success: false, error: err.message ?? String(err) };