Skip to content

Commit

Permalink
threadRelations -> expiredThreadRelations
Browse files Browse the repository at this point in the history
  • Loading branch information
miya committed Oct 18, 2024
1 parent df8e58f commit fb767d3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/app/src/features/openai/server/services/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ class OpenaiService implements IOpenaiService {
}

public async deleteExpiredThreads(limit: number): Promise<void> {
const threadRelations = await ThreadRelationModel.getExpiredThreadRelations(limit);
if (threadRelations == null) {
const expiredThreadRelations = await ThreadRelationModel.getExpiredThreadRelations(limit);
if (expiredThreadRelations == null) {
return;
}

const deletedThreadIds: string[] = [];
for (const threadRelation of threadRelations) {
for (const expiredThreadRelation of expiredThreadRelations) {
try {
// eslint-disable-next-line no-await-in-loop
const deleteThreadResponse = await this.client.deleteThread(threadRelation.threadId);
const deleteThreadResponse = await this.client.deleteThread(expiredThreadRelation.threadId);
logger.debug('Delete thread', deleteThreadResponse);
deletedThreadIds.push(threadRelation.threadId);
deletedThreadIds.push(expiredThreadRelation.threadId);
}
catch (err) {
logger.error(err);
Expand Down

0 comments on commit fb767d3

Please sign in to comment.