Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
119
fork

Configure Feed

Select the types of activity you want to include in your feed.

at a876aae44ea07494ebea9727350aa060b81f317b 35 lines 710 B view raw
1import {timeout} from '#/lib/async/timeout' 2import {isNetworkError} from '#/lib/strings/errors' 3 4export async function retry<P>( 5 retries: number, 6 shouldRetry: (err: any) => boolean, 7 action: () => Promise<P>, 8 delay?: number, 9): Promise<P> { 10 let lastErr 11 while (retries > 0) { 12 try { 13 return await action() 14 } catch (e: any) { 15 lastErr = e 16 if (shouldRetry(e)) { 17 if (delay) { 18 await timeout(delay) 19 } 20 retries-- 21 continue 22 } 23 throw e 24 } 25 } 26 throw lastErr 27} 28 29export async function networkRetry<P>( 30 retries: number, 31 fn: () => Promise<P>, 32 delay?: number, 33): Promise<P> { 34 return retry(retries, isNetworkError, fn, delay) 35}