mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-12 06:27:10 +03:00
Don't fallback to db when too many redis connections
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import redis from "../utils/redis";
|
||||
import redis, { TooManyActiveConnectionsError } from "../utils/redis";
|
||||
import { Logger } from "../utils/logger";
|
||||
import { skipSegmentsHashKey, skipSegmentsKey, reputationKey, ratingHashKey, skipSegmentGroupsKey, userFeatureKey, videoLabelsKey, videoLabelsHashKey, brandingHashKey, brandingKey } from "./redisKeys";
|
||||
import { Service, VideoID, VideoIDHash } from "../types/segments.model";
|
||||
@@ -13,7 +13,11 @@ async function get<T>(fetchFromDB: () => Promise<T>, key: string): Promise<T> {
|
||||
|
||||
return JSON.parse(reply);
|
||||
}
|
||||
} catch (e) { } //eslint-disable-line no-empty
|
||||
} catch (e) {
|
||||
if (e instanceof TooManyActiveConnectionsError) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
const data = await fetchFromDB();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user