File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
app/(frontend)/api/sync-ch Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,21 @@ export const maxDuration = 300 // 5 mins (max on vercel pro plan)
99export const dynamic = 'force-dynamic'
1010
1111export async function GET ( ) : Promise < NextResponse > {
12- await clearDuplicateThreads ( )
13- await fetchDiscord ( )
14- await fetchGitHub ( )
15- await syncToAlgolia ( )
12+ const tasks = [
13+ { name : 'clearDuplicateThreads' , fn : clearDuplicateThreads } ,
14+ { name : 'fetchDiscord' , fn : fetchDiscord } ,
15+ { name : 'fetchGitHub' , fn : fetchGitHub } ,
16+ { name : 'syncToAlgolia' , fn : syncToAlgolia } ,
17+ ]
18+
19+ // Execute each task, catch errors, and log them
20+ for ( const { name, fn } of tasks ) {
21+ try {
22+ await fn ( )
23+ } catch ( error ) {
24+ console . error ( `Error in ${ name } :` , error )
25+ }
26+ }
1627
1728 return NextResponse . json ( ( JSON . stringify ( { success : true } ) , { status : 200 } ) )
1829}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export const updateAlgolia = async (id: string, helpful: boolean): Promise<void>
1717 objectID : id ,
1818 } ,
1919 {
20- createIfNotExists : false ,
20+ createIfNotExists : true ,
2121 } ,
2222 )
2323 . then ( ( ) => {
You can’t perform that action at this time.
0 commit comments