diff --git a/src/repositories/shuttle/RedisShuttleRepository.ts b/src/repositories/shuttle/RedisShuttleRepository.ts index cd90147..1a6b4d0 100644 --- a/src/repositories/shuttle/RedisShuttleRepository.ts +++ b/src/repositories/shuttle/RedisShuttleRepository.ts @@ -566,6 +566,7 @@ export class RedisShuttleRepository extends BaseRedisRepository implements Shutt if (keys.length > 0) { await this.redisClient.del(keys); } + await this.clearShuttleLastStopData(); } public async clearOrderedStopData(): Promise { @@ -588,4 +589,11 @@ export class RedisShuttleRepository extends BaseRedisRepository implements Shutt await this.redisClient.del(keys); } } + + private async clearShuttleLastStopData(): Promise { + const keys = await this.redisClient.keys('shuttle:laststop:*'); + if (keys.length > 0) { + await this.redisClient.del(keys); + } + } } diff --git a/src/repositories/shuttle/UnoptimizedInMemoryShuttleRepository.ts b/src/repositories/shuttle/UnoptimizedInMemoryShuttleRepository.ts index 14ba7d7..8b7a3d5 100644 --- a/src/repositories/shuttle/UnoptimizedInMemoryShuttleRepository.ts +++ b/src/repositories/shuttle/UnoptimizedInMemoryShuttleRepository.ts @@ -284,6 +284,7 @@ export class UnoptimizedInMemoryShuttleRepository public async clearShuttleData(): Promise { this.shuttles = []; + await this.clearShuttleLastStopData(); } public async clearOrderedStopData(): Promise { @@ -298,4 +299,7 @@ export class UnoptimizedInMemoryShuttleRepository this.stops = []; } + private async clearShuttleLastStopData(): Promise { + this.shuttleLastStopArrivals.clear(); + } }