Resolved linting issues
This commit is contained in:
2
src/cache/redisMock.js
vendored
2
src/cache/redisMock.js
vendored
@@ -12,7 +12,7 @@ const redisMockClient = {
|
||||
return Promise.resolve(callback(null, "OK"));
|
||||
},
|
||||
expire(key, TTL) {
|
||||
// console.log(`redis-dummy expire: ${key} with TTL ${TTL}`); // eslint-disable-line no-console
|
||||
console.log(`redis-dummy expire: ${key} with TTL ${TTL}`); // eslint-disable-line no-console
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class Plex {
|
||||
headers: { Accept: "application/json" }
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
return new Promise((resolve, reject) => {
|
||||
this.cache
|
||||
.get(cacheKey)
|
||||
.then(machineInfo => resolve(machineInfo?.machineIdentifier))
|
||||
@@ -132,8 +132,8 @@ class Plex {
|
||||
}
|
||||
|
||||
reject(new PlexUnexpectedError());
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async existsInPlex(tmdb) {
|
||||
@@ -185,16 +185,19 @@ class Plex {
|
||||
|
||||
const url = `http://${this.plexIP}:${
|
||||
this.plexPort
|
||||
}/hubs/search?query=${fixedEncodeURIComponent(query)}`;
|
||||
}/hubs/search?query=${fixedEncodeURIComponent(query)}&X-Plex-Token=${
|
||||
this.token
|
||||
}`;
|
||||
|
||||
const options = {
|
||||
timeout: 20000,
|
||||
headers: { Accept: "application/json" }
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
return new Promise((resolve, reject) => {
|
||||
this.cache
|
||||
.get(cacheKey)
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
// else fetch fresh data
|
||||
return fetch(url, options)
|
||||
.then(successfullResponse)
|
||||
@@ -208,8 +211,8 @@ class Plex {
|
||||
}
|
||||
|
||||
reject(new PlexUnexpectedError());
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// this is not guarenteed to work, but if we see a movie or
|
||||
@@ -224,7 +227,7 @@ class Plex {
|
||||
// TODO improve cache key matching by lowercasing it on the backend.
|
||||
// what do we actually need to check for if the key was deleted or not
|
||||
// it might be an error or another response code.
|
||||
console.log("Unable to delete, key might not exists");
|
||||
console.log("Unable to delete, key might not exists"); // eslint-disable-line no-console
|
||||
return response === 1;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user