Skip to content

Commit

Permalink
feat(next/api): disable ticket duration metric
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjdd committed Mar 21, 2024
1 parent d000aaf commit d8e8c5f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
6 changes: 1 addition & 5 deletions next/api/src/model/Ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { TicketUpdater, UpdateOptions } from '@/ticket/TicketUpdater';
import htmlify from '@/utils/htmlify';
import { emailService } from '@/support-email/services/email';
import { categoryService } from '@/category';
import { durationMetricService } from '@/ticket/services/duration-metric';
import { Category } from './Category';
import { File } from './File';
import { Group } from './Group';
Expand Down Expand Up @@ -330,7 +329,7 @@ export class Ticket extends Model {
}
}
}
const newTicket = await updater.update(data.author, { useMasterKey: true });
await updater.update(data.author, { useMasterKey: true });

events.emit('reply:created', {
reply: reply.toJSON(),
Expand All @@ -344,8 +343,6 @@ export class Ticket extends Model {
console.error(`[Ticket] send email to requester`, error);
});
}

await durationMetricService.recordReplyTicket(newTicket, reply, isCustomerService);
}

return reply;
Expand Down Expand Up @@ -384,7 +381,6 @@ export class Ticket extends Model {
(options?.cascade ? [...associateTickets, this] : [this]).map(async (ticket) => {
const updater = new TicketUpdater(ticket);
const updatedTicket = await updater.operate(action).update(operator, options);
await durationMetricService.recordOperateTicket(ticket, action);
return updatedTicket;
})
);
Expand Down
2 changes: 0 additions & 2 deletions next/api/src/ticket/TicketCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { User, systemUser } from '@/model/User';
import { TicketLog } from '@/model/TicketLog';
import { searchTicketService } from '@/service/search-ticket';
import { ticketService } from '@/service/ticket';
import { durationMetricService } from './services/duration-metric';

export class TicketCreator {
private author?: User;
Expand Down Expand Up @@ -274,7 +273,6 @@ export class TicketCreator {
customFields: this.customFields,
});

await durationMetricService.createMetric(ticket);
await searchTicketService.addSyncJob([ticket.id]);
await ticketService.addDetectTicketLanguageJob(ticket.id);

Expand Down
1 change: 1 addition & 0 deletions next/api/src/ticket/services/duration-metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class DurationMetricService {
createMetric(ticket: Ticket) {
return DurationMetrics.create(
{
ACL: {},
ticketId: ticket.id,
ticketCreatedAt: ticket.createdAt,
},
Expand Down

0 comments on commit d8e8c5f

Please sign in to comment.