Override completion on OOM crashes
This commit is contained in:
@@ -344,7 +344,7 @@ export class EventRepository {
|
||||
});
|
||||
}
|
||||
|
||||
async queryIncompleteEvents(queryOptions: QueryOptions) {
|
||||
async queryIncompleteEvents(queryOptions: QueryOptions, allowCompleteDuplicate = false) {
|
||||
// First we will find all the events that match the query options (selecting minimal data).
|
||||
const taskEvents = await this.readReplica.taskEvent.findMany({
|
||||
where: queryOptions,
|
||||
@@ -362,6 +362,10 @@ export class EventRepository {
|
||||
// If the event is cancelled, it is not incomplete
|
||||
if (event.isCancelled) return false;
|
||||
|
||||
if (allowCompleteDuplicate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// There must not be another complete event with the same spanId
|
||||
const hasCompleteDuplicate = taskEvents.some(
|
||||
(otherEvent) =>
|
||||
|
||||
@@ -75,9 +75,12 @@ export class CrashTaskRunService extends BaseService {
|
||||
},
|
||||
});
|
||||
|
||||
const inProgressEvents = await eventRepository.queryIncompleteEvents({
|
||||
runId: taskRun.friendlyId,
|
||||
});
|
||||
const inProgressEvents = await eventRepository.queryIncompleteEvents(
|
||||
{
|
||||
runId: taskRun.friendlyId,
|
||||
},
|
||||
options?.overrideCompletion
|
||||
);
|
||||
|
||||
logger.debug("Crashing in-progress events", {
|
||||
inProgressEvents: inProgressEvents.map((event) => event.id),
|
||||
|
||||
Reference in New Issue
Block a user