Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

323 B
Raw Blame
import { getDatabasePool } from ".";

let held = 0;

/** Holders pin a pooled client, so one always stays free for their queries. */
export function reserveSessionLock(): boolean {
  if (held >= getDatabasePool().options.max - 1) return false;
  held++;
  return true;
}

export function releaseSessionLock() {
  held--;
}