mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-25 08:58:23 +03:00
Add eslint rules for dealing with promises
This commit is contained in:
@@ -53,7 +53,7 @@ async function getAndSplit<T, U extends string>(fetchFromDB: (values: U[]) => Pr
|
||||
if (valuesToBeFetched.length > 0) {
|
||||
data = await fetchFromDB(valuesToBeFetched);
|
||||
|
||||
new Promise(() => {
|
||||
void new Promise(() => {
|
||||
const newResults: Record<string, T[]> = {};
|
||||
for (const item of data) {
|
||||
const splitValue = (item as unknown as Record<string, string>)[splitKey];
|
||||
|
||||
@@ -28,7 +28,7 @@ let exportClient: RedisSB = {
|
||||
if (config.redis?.enabled) {
|
||||
Logger.info("Connected to redis");
|
||||
const client = createClient(config.redis);
|
||||
client.connect();
|
||||
void client.connect(); // void as we don't care about the promise
|
||||
exportClient = client as RedisSB;
|
||||
|
||||
const get = client.get.bind(client);
|
||||
@@ -40,7 +40,7 @@ if (config.redis?.enabled) {
|
||||
}).catch((err) => reject(err));
|
||||
});
|
||||
exportClient.increment = (key) => new Promise((resolve, reject) =>
|
||||
client.multi()
|
||||
void client.multi()
|
||||
.incr(key)
|
||||
.expire(key, 60)
|
||||
.exec()
|
||||
|
||||
@@ -39,8 +39,8 @@ export class YouTubeAPI {
|
||||
}
|
||||
const apiResult = data as APIVideoData;
|
||||
DiskCache.set(cacheKey, apiResult)
|
||||
.catch((err: any) => Logger.warn(err))
|
||||
.then(() => Logger.debug(`YouTube API: video information cache set for: ${videoID}`));
|
||||
.then(() => Logger.debug(`YouTube API: video information cache set for: ${videoID}`))
|
||||
.catch((err: any) => Logger.warn(err));
|
||||
|
||||
return { err: false, data: apiResult };
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user