Trunk based development and continuous delivery with circleCI

Hello,

Recently our team moved to trunk-based development to deliver production features faster.

We are using a monorepo the path-filtering and the eddieweb queue orb to manage workflows. The workflow on a high level looks like this:

  1. PR in main is merged by an engineer and circleCI gets triggered
  2. The queue orb will check if the job is queued or not by talking to the circleCI API
  3. Run the path-filtering orb and trigger the respective workflow

The problem is that some times in step-2, the queue won’t manage two PRs that were merged within 90 seconds (some times more than 90s). There’s no guarantee that the VM to run the workflow will spin up in 5s or 30s. The race condition triggers two workflows that run in parallel instead of running serially.

Are there any circleCI facilities we could use to solve the problem?