Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions internal/app/frontend/frontend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,28 @@ func doCreateTicket(ctx context.Context, req *pb.CreateTicketRequest, store stat

err = store.IndexTicket(ctx, ticket)
if err != nil {
// Schedule a ticket deletion on the background
go func() {
ctx, span := trace.StartSpan(context.Background(), "open-match/frontend.cleanupNewTicket")
defer span.End()

err := store.DeleteTicket(ctx, ticket.Id)
if err != nil {
logger.WithFields(logrus.Fields{
"error": err.Error(),
"id": ticket.Id,
}).Error("failed to delete the recently created ticket")
}

err = store.DeleteTicketsFromPendingRelease(ctx, []string{ticket.Id})
if err != nil {
logger.WithFields(logrus.Fields{
"error": err.Error(),
"id": ticket.Id,
}).Error("failed to delete the recently created ticket from pendingRelease")
}
}()

return nil, err
}

Expand Down Expand Up @@ -136,6 +158,20 @@ func doCreateBackfill(ctx context.Context, req *pb.CreateBackfillRequest, store
}
err = store.IndexBackfill(ctx, backfill)
if err != nil {
// Schedule a backfill deletion on a background
go func() {
ctx, span := trace.StartSpan(context.Background(), "open-match/frontend.cleanupNewBackfill")
defer span.End()

err := store.DeleteBackfillCompletely(ctx, backfill.Id)
if err != nil {
logger.WithFields(logrus.Fields{
"error": err.Error(),
"id": backfill.Id,
}).Error("failed to delete the recently created backfill")
}
}()

return nil, err
}
return backfill, nil
Expand Down