fix: potentially unstable custom domain name dns
This commit is contained in:
parent
c94b90bcb4
commit
3c163dff59
|
|
@ -55,8 +55,10 @@ export async function GET(req: Request) {
|
|||
}
|
||||
} else {
|
||||
const tenant = await fetchTenant(realHost, 5)
|
||||
return {
|
||||
subdomain: tenant,
|
||||
if (tenant) {
|
||||
return {
|
||||
subdomain: tenant,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ export async function cacheGet(options: {
|
|||
if (!options.noUpdate) {
|
||||
setTimeout(() => {
|
||||
options.getValueFun().then((value) => {
|
||||
redis.set(redisKey, JSON.stringify(value), "EX", REDIS_EXPIRE)
|
||||
if (value) {
|
||||
redis.set(redisKey, JSON.stringify(value), "EX", REDIS_EXPIRE)
|
||||
}
|
||||
})
|
||||
}, Math.random() * REDIS_REFRESH)
|
||||
}
|
||||
|
|
@ -60,19 +62,23 @@ export async function cacheGet(options: {
|
|||
} else {
|
||||
if (options.allowEmpty) {
|
||||
options.getValueFun().then(async (value) => {
|
||||
if (options.noUpdate) {
|
||||
await redis.set(redisKey, JSON.stringify(value))
|
||||
} else {
|
||||
redis.set(redisKey, JSON.stringify(value), "EX", REDIS_EXPIRE)
|
||||
if (value) {
|
||||
if (options.noUpdate) {
|
||||
await redis.set(redisKey, JSON.stringify(value))
|
||||
} else {
|
||||
redis.set(redisKey, JSON.stringify(value), "EX", REDIS_EXPIRE)
|
||||
}
|
||||
}
|
||||
})
|
||||
return null
|
||||
} else {
|
||||
const value = await options.getValueFun()
|
||||
if (options.noUpdate) {
|
||||
await redis.set(redisKey, JSON.stringify(value))
|
||||
} else {
|
||||
redis.set(redisKey, JSON.stringify(value), "EX", REDIS_EXPIRE)
|
||||
if (value) {
|
||||
if (options.noUpdate) {
|
||||
await redis.set(redisKey, JSON.stringify(value))
|
||||
} else {
|
||||
redis.set(redisKey, JSON.stringify(value), "EX", REDIS_EXPIRE)
|
||||
}
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue