|
|
@@ -37,7 +37,6 @@ import {
|
|
|
} from '../homepage/homepage.constants';
|
|
|
import { CategoryDto } from '../homepage/dto/homepage.dto';
|
|
|
import { VideoListItemDto } from './dto/video-list-response.dto';
|
|
|
-import { VideoListItemDto } from './dto/video-list-response.dto';
|
|
|
|
|
|
/**
|
|
|
* VideoService provides read-only access to video data from Redis cache.
|
|
|
@@ -110,9 +109,6 @@ export class VideoService {
|
|
|
const cacheKey = `video:list:${Buffer.from(
|
|
|
JSON.stringify(dto),
|
|
|
).toString('base64')}`;
|
|
|
- const cacheKey = `video:list:${Buffer.from(
|
|
|
- JSON.stringify(dto),
|
|
|
- ).toString('base64')}`;
|
|
|
|
|
|
if(!ttl){
|
|
|
ttl = random ? 15 : 300;
|
|
|
@@ -175,8 +171,6 @@ export class VideoService {
|
|
|
orderBy: [{ addedTime: 'desc' }, { createdAt: 'desc' }],
|
|
|
skip: start,
|
|
|
take: size,
|
|
|
- skip: start,
|
|
|
- take: size,
|
|
|
select: {
|
|
|
id: true,
|
|
|
title: true,
|
|
|
@@ -186,13 +180,10 @@ export class VideoService {
|
|
|
preFileName: true,
|
|
|
},
|
|
|
})) as VideoListItemDto[];
|
|
|
- })) as VideoListItemDto[];
|
|
|
}
|
|
|
|
|
|
if (fallbackRecords.length > 0) {
|
|
|
await this.redis.setJson(cacheKey, fallbackRecords, ttl);
|
|
|
- if (fallbackRecords.length > 0) {
|
|
|
- await this.redis.setJson(cacheKey, fallbackRecords, ttl);
|
|
|
}
|
|
|
|
|
|
return fallbackRecords;
|
|
|
@@ -203,14 +194,6 @@ export class VideoService {
|
|
|
);
|
|
|
return [];
|
|
|
}
|
|
|
- return fallbackRecords;
|
|
|
- } catch (err) {
|
|
|
- this.logger.error(
|
|
|
- `Error fetching videos from MongoDB`,
|
|
|
- err instanceof Error ? err.stack : String(err),
|
|
|
- );
|
|
|
- return [];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|