Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

712 B
Raw Blame
import { measurePhoto } from './photo-signals-runner';

import { parentPort } from 'node:worker_threads';

/**
 * The photo signals' thread: says it is ready once its script has loaded (so
 * the runner can tell a thread that never started from a photo that broke
 * one), then measures the photos it is sent and answers each by its id.
 * `measurePhoto` answers null for anything it cannot read and never throws, so
 * every photo gets its answer.
 */
parentPort?.on('message', (message: { id: number; bytes?: Uint8Array }) => {
  if (!message.bytes) return;
  void measurePhoto(message.bytes).then((pixels) => parentPort?.postMessage({ id: message.id, pixels }));
});
parentPort?.postMessage({ ready: true });