mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-19 08:50:29 +00:00
Make BaseRedisRepository extend EventEmitter; make RedisShuttleRepository extend BaseRedisRepository
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import EventEmitter from "node:events";
|
||||
import { createClient } from 'redis';
|
||||
import { ShuttleGetterSetterRepository } from "./ShuttleGetterSetterRepository";
|
||||
import { IEta, IOrderedStop, IRoute, IShuttle, IStop, shuttleHasArrivedAtStop } from "../../entities/ShuttleRepositoryEntities";
|
||||
import { REDIS_RECONNECT_INTERVAL } from "../../environment";
|
||||
import {
|
||||
ShuttleRepositoryEvent,
|
||||
ShuttleRepositoryEventListener,
|
||||
@@ -12,27 +9,9 @@ import {
|
||||
ShuttleTravelTimeDataIdentifier,
|
||||
ShuttleTravelTimeDateFilterArguments,
|
||||
} from "./ShuttleGetterRepository";
|
||||
import { BaseRedisRepository } from "../BaseRedisRepository";
|
||||
|
||||
export class RedisShuttleRepository extends EventEmitter implements ShuttleGetterSetterRepository {
|
||||
protected redisClient;
|
||||
|
||||
constructor(
|
||||
redisClient = createClient({
|
||||
url: process.env.REDIS_URL,
|
||||
socket: {
|
||||
tls: process.env.NODE_ENV === 'production',
|
||||
rejectUnauthorized: false,
|
||||
reconnectStrategy: REDIS_RECONNECT_INTERVAL,
|
||||
},
|
||||
}),
|
||||
) {
|
||||
super();
|
||||
this.redisClient = redisClient;
|
||||
this.redisClient.on('error', (err) => {
|
||||
console.error(err.stack);
|
||||
});
|
||||
}
|
||||
|
||||
export class RedisShuttleRepository extends BaseRedisRepository implements ShuttleGetterSetterRepository {
|
||||
get isReady() {
|
||||
return this.redisClient.isReady;
|
||||
}
|
||||
|
||||
@@ -37,33 +37,6 @@ export class RedisExternalSourceETARepository extends BaseRedisRepository implem
|
||||
removeAllListeners(eventName?: string | symbol | undefined): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
setMaxListeners(n: number): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getMaxListeners(): number {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
listeners<K>(eventName: string | symbol): Function[] {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
rawListeners<K>(eventName: string | symbol): Function[] {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
emit<K>(eventName: string | symbol, ...args: any[]): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
listenerCount<K>(eventName: string | symbol, listener?: Function | undefined): number {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
prependListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
eventNames(): (string | symbol)[] {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
clearAllData(): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
@@ -53,32 +53,4 @@ export class RedisSelfUpdatingETARepository extends BaseRedisRepository implemen
|
||||
removeAllListeners(eventName?: string | symbol | undefined): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
setMaxListeners(n: number): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getMaxListeners(): number {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
listeners<K>(eventName: string | symbol): Function[] {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
rawListeners<K>(eventName: string | symbol): Function[] {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
emit<K>(eventName: string | symbol, ...args: any[]): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
listenerCount<K>(eventName: string | symbol, listener?: Function | undefined): number {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
prependListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
eventNames(): (string | symbol)[] {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user