Simplify code
This commit is contained in:
parent
826835e518
commit
c6691cf1cb
1 changed files with 3 additions and 3 deletions
|
@ -125,12 +125,12 @@ async function handleRequest(request) {
|
||||||
|
|
||||||
async function handleConfigRequest(request) {
|
async function handleConfigRequest(request) {
|
||||||
let response = await readCache(request);
|
let response = await readCache(request);
|
||||||
|
const networkResponsePromise = fetchAndUpdateConfig(request);
|
||||||
if (response) {
|
if (response) {
|
||||||
fetchAndUpdateConfig(request);
|
|
||||||
return response;
|
return response;
|
||||||
|
} else {
|
||||||
|
return await networkResponsePromise;
|
||||||
}
|
}
|
||||||
response = await fetchAndUpdateConfig(request);
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchAndUpdateConfig(request) {
|
async function fetchAndUpdateConfig(request) {
|
||||||
|
|
Reference in a new issue