Wait faster lol
This commit is contained in:
parent
c53f669aad
commit
a6d2990e7a
1 changed files with 2 additions and 2 deletions
4
index.js
4
index.js
|
@ -23,7 +23,7 @@ app.get("/cached/*", (req, res) => {
|
||||||
var imgWait = 0
|
var imgWait = 0
|
||||||
function waitForImage() {
|
function waitForImage() {
|
||||||
if (imgWait < imgWaitMax) {
|
if (imgWait < imgWaitMax) {
|
||||||
imgWait += 0.5
|
imgWait += 0.1
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
imgData = cachedImages[imgURL]
|
imgData = cachedImages[imgURL]
|
||||||
if (imgData) {
|
if (imgData) {
|
||||||
|
@ -31,7 +31,7 @@ app.get("/cached/*", (req, res) => {
|
||||||
} else {
|
} else {
|
||||||
waitForImage()
|
waitForImage()
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 100);
|
||||||
} else {
|
} else {
|
||||||
fs.createReadStream(path.join(__dirname, "/imgs/notFound.png")).pipe(res)
|
fs.createReadStream(path.join(__dirname, "/imgs/notFound.png")).pipe(res)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue