mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-13 16:07:32 +08:00
feat: user control fluid search
This commit is contained in:
@@ -35,7 +35,7 @@ export async function GET(request: Request) {
|
||||
Promise.race([
|
||||
searchFromApi(site, query),
|
||||
new Promise((_, reject) =>
|
||||
setTimeout(() => reject(new Error(`${site.name} timeout`)), 20000)
|
||||
setTimeout(() => reject(new Error(`${site.name} timeout`)), 10000)
|
||||
),
|
||||
]).catch((err) => {
|
||||
console.warn(`搜索失败 ${site.name}:`, err.message);
|
||||
|
||||
@@ -66,10 +66,10 @@ export async function GET(request: NextRequest) {
|
||||
|
||||
// 记录已完成的源数量
|
||||
let completedSources = 0;
|
||||
let allResults: any[] = [];
|
||||
const allResults: any[] = [];
|
||||
|
||||
// 为每个源创建搜索 Promise
|
||||
const searchPromises = apiSites.map(async (site, index) => {
|
||||
const searchPromises = apiSites.map(async (site) => {
|
||||
try {
|
||||
// 添加超时控制
|
||||
const searchPromise = Promise.race([
|
||||
|
||||
Reference in New Issue
Block a user