FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
project logo
maxmsimpleSqliteLock
Public
Like
simpleSqliteLock
Home
Code
4
README.md
C
example
foo
lock
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Simple Sqlite Lock

This lock works by checking to see if another Val has attempted to acquire the lock within the last N seconds. If any have, it returns an error. This doesn't allow for releasing locks, and is mostly to help with simple cases where you want to make sure two executions don't start within a specific time window.

You could use it in a cron like so:

Create val
import { SqliteLock } from "https://esm.town/v/maxm/simpleSqliteLock/lock"; const twoMinutes = 120; const lock = new SqliteLock(projectVal.name, twoMinutes); export default async function(interval: Interval) { await lock.lock() }
Cron
  • example
Code
README.md
C
example
foolock
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.