File size: 463 Bytes
c4ae742
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import { describe, expect, it } from "vitest";

import { POSTGRES_TAKE_NEXT_ITEM_SQL } from "../queue/postgres-store.js";

describe("Postgres queue store", () => {
  it("uses row locks with SKIP LOCKED for multi-instance item consumption", () => {
    expect(POSTGRES_TAKE_NEXT_ITEM_SQL).toMatch(/FOR UPDATE SKIP LOCKED/i);
    expect(POSTGRES_TAKE_NEXT_ITEM_SQL).toMatch(/UPDATE items/i);
    expect(POSTGRES_TAKE_NEXT_ITEM_SQL).toMatch(/RETURNING/i);
  });
});