Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  session-async-task-status.ts

  Sprache: JAVA
 

Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

import { normalizeOptionalString } from "../shared/string-coerce.js";
import { listTasksForOwnerKey } from "../tasks/runtime-internal.js";
import type { TaskRecord, TaskRuntime, TaskStatus } from "../tasks/task-registry.types.js";

const DEFAULT_ACTIVE_STATUSES = new Set<TaskStatus>(["queued", "running"]);

export function findActiveSessionTask(params: {
  sessionKey?: string;
  runtime?: TaskRuntime;
  taskKind?: string;
  statuses?: ReadonlySet<TaskStatus>;
  sourceIdPrefix?: string;
}): TaskRecord | undefined {
  const normalizedSessionKey = normalizeOptionalString(params.sessionKey);
  if (!normalizedSessionKey) {
    return undefined;
  }
  const statuses = params.statuses ?? DEFAULT_ACTIVE_STATUSES;
  const taskKind = normalizeOptionalString(params.taskKind);
  const sourceIdPrefix = normalizeOptionalString(params.sourceIdPrefix);
  const matches = listTasksForOwnerKey(normalizedSessionKey).filter((task) => {
    if (task.scopeKind !== "session") {
      return false;
    }
    if (params.runtime && task.runtime !== params.runtime) {
      return false;
    }
    if (!statuses.has(task.status)) {
      return false;
    }
    if (taskKind && task.taskKind !== taskKind) {
      return false;
    }
    if (sourceIdPrefix) {
      const sourceId = normalizeOptionalString(task.sourceId) ?? "";
      if (sourceId !== sourceIdPrefix && !sourceId.startsWith(`${sourceIdPrefix}:`)) {
        return false;
      }
    }
    return true;
  });
  if (matches.length === 0) {
    return undefined;
  }
  return matches.find((task) => task.status === "running") ?? matches[0];
}

export function buildSessionAsyncTaskStatusDetails(task: TaskRecord): Record<string, unknown> {
  return {
    async: true,
    active: true,
    existingTask: true,
    status: task.status,
    task: {
      taskId: task.taskId,
      ...(task.runId ? { runId: task.runId } : {}),
    },
    ...(task.taskKind ? { taskKind: task.taskKind } : {}),
    ...(task.progressSummary ? { progressSummary: task.progressSummary } : {}),
    ...(task.sourceId ? { sourceId: task.sourceId } : {}),
  };
}

¤ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge