Skip to content

Commit cd5d2ae

Browse files
committed
Override completion on OOM crashes
1 parent 0e77e7e commit cd5d2ae

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

apps/webapp/app/v3/eventRepository.server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export class EventRepository {
344344
});
345345
}
346346

347-
async queryIncompleteEvents(queryOptions: QueryOptions) {
347+
async queryIncompleteEvents(queryOptions: QueryOptions, allowCompleteDuplicate = false) {
348348
// First we will find all the events that match the query options (selecting minimal data).
349349
const taskEvents = await this.readReplica.taskEvent.findMany({
350350
where: queryOptions,
@@ -362,6 +362,10 @@ export class EventRepository {
362362
// If the event is cancelled, it is not incomplete
363363
if (event.isCancelled) return false;
364364

365+
if (allowCompleteDuplicate) {
366+
return true;
367+
}
368+
365369
// There must not be another complete event with the same spanId
366370
const hasCompleteDuplicate = taskEvents.some(
367371
(otherEvent) =>

apps/webapp/app/v3/services/crashTaskRun.server.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ export class CrashTaskRunService extends BaseService {
7575
},
7676
});
7777

78-
const inProgressEvents = await eventRepository.queryIncompleteEvents({
79-
runId: taskRun.friendlyId,
80-
});
78+
const inProgressEvents = await eventRepository.queryIncompleteEvents(
79+
{
80+
runId: taskRun.friendlyId,
81+
},
82+
options?.overrideCompletion
83+
);
8184

8285
logger.debug("Crashing in-progress events", {
8386
inProgressEvents: inProgressEvents.map((event) => event.id),

0 commit comments

Comments
 (0)