Started linting source files

This commit is contained in:
2022-08-19 13:47:08 +02:00
parent 64dbec1f14
commit b1d959389d
55 changed files with 726 additions and 526 deletions

11
src/cache/redis.js vendored
View File

@@ -1,4 +1,3 @@
const { promisify } = require("util");
const configuration = require("../config/configuration").getInstance();
let client;
@@ -16,7 +15,7 @@ try {
client.on("connect", () => console.log("Redis connection established!"));
client.on("error", function (err) {
client.on("error", () => {
client.quit();
console.error("Unable to connect to redis, setting up redis-mock.");
@@ -38,7 +37,7 @@ function set(key, value, TTL = 10800) {
const json = JSON.stringify(value);
client.set(key, json, (error, reply) => {
if (reply == "OK") {
if (reply === "OK") {
// successfully set value with key, now set TTL for key
client.expire(key, TTL, e => {
if (e)
@@ -55,14 +54,14 @@ function set(key, value, TTL = 10800) {
return value;
}
function get() {
function get(key) {
return new Promise((resolve, reject) => {
client.get(key, (error, reply) => {
if (reply == null) {
if (reply === null) {
return reject();
}
resolve(JSON.parse(reply));
return resolve(JSON.parse(reply));
});
});
}