
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
@joao-sada/gcs-mutex-lock
Advanced tools
Simple, scalable, distributed mutex for serialising computations that is backed by GCS
Simple, scalable, distributed mutex for serialising computations that is backed by GCS.
yarn add gcs-mutex-lock
gsutil mb gs://your-bucket-name
.gsutil versioning set on gs://your-bucket-name
.gsutil lifecycle set <config-json-file> gs://your-bucket-name
. See this README for an explanation on this.{
"rule": [
{
"action": { "type": "Delete" },
"condition": { "age": 1 }
}
]
}
import MutexLock from 'gcs-mutex-lock'
const lock = new MutexLock({
/* @google-cloud/storage options for new Storage() */
storageOptions: {},
bucket: 'mutex-locks',
object: 'my-lock',
})
async function main() {
const { success, err } = await lock.acquire()
// In most cases the lock is probably already acquired.
// The err is available for extra context.
if (!success) {
console.error('Failed to acquire lock', err)
return
}
try {
// serialised computation happens here.
} finally {
await lock.release()
}
}
import MutexLock from 'gcs-mutex-lock'
const lock = new MutexLock({
// wait up to 1 minute when trying to acquire a lock
timeout: 60_000,
})
WARNING: Failure to call release will hold the mutex and deadlock the application. Make sure to call release under all circumstances and handle exceptions accordingly.
new Mutex(options: Object)
Creates a new Mutex lock. See types for a complete set of options. By default acquire
and release
will wait indefinitely when trying to acquire or relinquish a lock. For convenience you can configure timeouts, backoff behaviour, retries etc.
mutex.acquire()
Returns a promise that will resolve as soon as the mutex is locked. If the lock is already in use then acquire()
will wait until the mutex is available.
mutex.release()
Returns a promise that will resolve as soon as the mutex is unlocked. If the lock doesn't exist upon calling release()
an error will be thrown, otherwise release()
will wait until the mutex is unlocked.
This project is basically a port of Marc Cohen's gcslock library. I recommend reading their project's README for a better understanding of the limitations.
FAQs
Simple, scalable, distributed mutex for serialising computations that is backed by GCS
We found that @joao-sada/gcs-mutex-lock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.