Skip to content

mbrock/binary-semaphore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Binary Semaphore: a mutex lock to run on Heroku

This simple Node server offers an infinite set of mutexes via HTTP API.

You acquire a lock by PUT request to /lock/:id/:nonce.

There id is the lock's identifier, and nonce is a random string you choose which is used to prevent certain conflicts.

You release the lock by DELETE to that same path.

All acquired locks expire automatically in a hard-coded number of seconds.

That should probably be configurable.

CORS is allowed for any domain origin.

We use this in https://github.com/mbrock/telegroam.

It's useful e.g. if you have several browser scripts that need to use some resource without conflicting with each other.

Deploy

Note that you also need to enable Heroku Redis (the hobby free plan) on the created application.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors