lock-manager-worker-context.d.ts 794 B

123456789101112131415161718192021222324
  1. import { SpanKind } from '../enums';
  2. import { Span } from './telemetry';
  3. /**
  4. * Minimal interface that LockManager needs from Worker.
  5. * This allows LockManager to access worker methods without inheriting from QueueBase.
  6. */
  7. export interface LockManagerWorkerContext {
  8. /**
  9. * Extends locks for multiple jobs.
  10. */
  11. extendJobLocks(jobIds: string[], tokens: string[], duration: number): Promise<string[]>;
  12. /**
  13. * Emits events to worker listeners.
  14. */
  15. emit(event: string | symbol, ...args: any[]): boolean;
  16. /**
  17. * Wraps code with telemetry tracing.
  18. */
  19. trace<T>(spanKind: SpanKind, operation: string, destination: string, callback: (span?: Span) => Promise<T> | T): Promise<T> | T;
  20. /**
  21. * Queue name for telemetry.
  22. */
  23. name: string;
  24. }