@brad-jones/dk8slock@0.2.0Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
brad-jones/dk8slockA distributed lock for deno powered by K8s Leases.
This package works with Node.js, Deno

JSR Score
100%
Published
10 months ago (0.2.0)
dk8slock
A distributed lock for deno (& other Js Runtimes) powered by K8s Leases.
Inspired by:
Quick Start
This uses the power of Disposeables to create a lock for the entire function.
Deno
import { disposeableLock } from "jsr:@brad-jones/dk8slock"; async function contentiousFunc() { await using _ = await disposeableLock("MyLock"); // Anything you do here is guaranteed to be only executing by a single worker. }
Node.js
Install the node package with your favorite package manager.
npm used here but pnpm, yarn & others all work in much the same way.
npm install @brad-jones/dk8slock
NB: Don't attempt to use the JSR package with Node.js it will not work!
Known Issues
-
@cloudydeno/kubernetes-clientleaks resources, it doesn't seem to close HttpClients.error: Leaks detected: - An HTTP client was created during the test, but not closed during the test. Close the HTTP client by calling `httpClient.close()`.Hence why our tests currently set
sanitizeResources: false
Built and signed on
GitHub Actions
Add Package
deno add jsr:@brad-jones/dk8slock
Import symbol
import * as dk_slock from "@brad-jones/dk8slock";
Import directly with a jsr specifier
import * as dk_slock from "jsr:@brad-jones/dk8slock";
Add Package
pnpm i jsr:@brad-jones/dk8slock
pnpm dlx jsr add @brad-jones/dk8slock
Import symbol
import * as dk_slock from "@brad-jones/dk8slock";
Add Package
yarn add jsr:@brad-jones/dk8slock
yarn dlx jsr add @brad-jones/dk8slock
Import symbol
import * as dk_slock from "@brad-jones/dk8slock";
Add Package
vlt install jsr:@brad-jones/dk8slock
Import symbol
import * as dk_slock from "@brad-jones/dk8slock";
Add Package
npx jsr add @brad-jones/dk8slock
Import symbol
import * as dk_slock from "@brad-jones/dk8slock";