Skip to content

Commit 5ca24c7

Browse files
committed
fix: disable in-memory cache
1 parent 92f686e commit 5ca24c7

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/submissions/submissions.service.ts

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { RabbitSubscribe } from '@golevelup/nestjs-rabbitmq';
22
import {
33
BadRequestException,
4-
CACHE_MANAGER,
54
forwardRef,
65
Inject,
76
Injectable,
87
} from '@nestjs/common';
98
import { InjectRepository } from '@nestjs/typeorm';
10-
import { Cache } from 'cache-manager';
119
import { TypedJSON } from 'typedjson';
1210
import { Repository } from 'typeorm';
1311
import { BenchmarkService } from '../benchmarks/benchmark.service';
@@ -23,7 +21,7 @@ export class SubmissionsService {
2321
constructor(
2422
@InjectRepository(Submission)
2523
private submissionsRepository: Repository<Submission>,
26-
@Inject(CACHE_MANAGER) private cacheManager: Cache,
24+
// @Inject(CACHE_MANAGER) private cacheManager: Cache,
2725
@Inject(forwardRef(() => BenchmarkService))
2826
private benchmarkService: BenchmarkService,
2927
) {}
@@ -74,16 +72,16 @@ export class SubmissionsService {
7472
queriedSubmission: FindSubmissionDTO,
7573
): Promise<Submission | undefined> {
7674
// First, try to get from cache
77-
const cachedSubmission = await this.cacheManager.get(queriedSubmission.id);
75+
// const cachedSubmission = await this.cacheManager.get(queriedSubmission.id);
7876

79-
if (cachedSubmission !== '') {
80-
const serializer = new TypedJSON(Submission);
77+
// if (cachedSubmission !== '') {
78+
// const serializer = new TypedJSON(Submission);
8179

82-
const submission = serializer.parse(cachedSubmission);
83-
if (submission) {
84-
return submission;
85-
}
86-
}
80+
// const submission = serializer.parse(cachedSubmission);
81+
// if (submission) {
82+
// return submission;
83+
// }
84+
// }
8785

8886
// Fallback to DB
8987
return this.submissionsRepository.findOne({ id: queriedSubmission.id });
@@ -103,24 +101,24 @@ export class SubmissionsService {
103101

104102
if (jobStatus) {
105103
// Set in DB
106-
const submission = await this.setStatus(
104+
await this.setStatus(
107105
jobStatus.id,
108106
jobStatus.status,
109107
jobStatus.stdout,
110108
jobStatus.stderr,
111109
jobStatus.exec_duration,
112110
);
113111

114-
if (submission) {
115-
const submissionSerializer = new TypedJSON(Submission);
112+
// if (submission) {
113+
// const submissionSerializer = new TypedJSON(Submission);
116114

117-
// Set in cache to speed up polling
118-
await this.cacheManager.set(
119-
jobStatus.id,
120-
submissionSerializer.stringify(submission),
121-
{ ttl: 600 },
122-
);
123-
}
115+
// // Set in cache to speed up polling
116+
// await this.cacheManager.set(
117+
// jobStatus.id,
118+
// submissionSerializer.stringify(submission),
119+
// { ttl: 600 },
120+
// );
121+
// }
124122
}
125123
}
126124

0 commit comments

Comments
 (0)