All problems

Film inspection batches exceed the concurrent inspection limit

Level 2 · node · Concurrency · Missing parallelism limit in asynchronous batch execution

Scenario

A fictional film preservation workshop checks films in storage boxes using asynchronous inspection equipment. Equipment is limited, so operators specify the maximum number of inspections in progress at once. Inspection results are collected correctly, but large batches run more simultaneous inspections than the equipment allows.

Requirements

Inspect films from the box with no more than the specified positive integer limit running concurrently. Inspect each film exactly once and return results in input order rather than completion order. For an empty box, return an empty array without invoking inspections. Only successful inspection functions are in scope; no external equipment connection is required.

Acceptance criteria

  • The number of inspections in progress never exceeds the specified concurrency limit.
  • Inspect every registered film exactly once and return results in registration order.
  • With a concurrency limit of one, run inspections one at a time.
  • Return an empty result array for an empty box without invoking inspections.