README.md in mongoid-locker-2.0.1 vs README.md in mongoid-locker-2.0.2
- old
+ new
@@ -1,24 +1,25 @@
# Mongoid-Locker
[![Gem Version](https://badge.fury.io/rb/mongoid-locker.svg)](https://badge.fury.io/rb/mongoid-locker)
+[![Test Status](https://github.com/mongoid/mongoid-locker/workflows/Test/badge.svg)](https://github.com/mongoid/mongoid-locker/actions)
[![Build Status](https://travis-ci.org/mongoid/mongoid-locker.svg?branch=master)](https://travis-ci.org/mongoid/mongoid-locker)
[![Maintainability](https://api.codeclimate.com/v1/badges/04ee4ee75ff54659300a/maintainability)](https://codeclimate.com/github/mongoid/mongoid-locker/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/04ee4ee75ff54659300a/test_coverage)](https://codeclimate.com/github/mongoid/mongoid-locker/test_coverage)
Document-level optimistic locking for MongoDB via Mongoid. Mongoid-Locker is an easy way to ensure only one process can perform a certain operation on a document at a time.
**NOTE:** Since version `2` Mongoid-Locker relies on MongoDB server time and not current client time, and does not perform any time calculation to get lock or release it. The basis of the current version are unique name of locking and time is set by MongoDB.
**NOTE:** Please refer to [1-x-stable](https://github.com/mongoid/mongoid-locker/tree/1-x-stable) branch for `1.x.x` documentation. See the [UPGRADING](UPGRADING.md) guide and [CHANGELOG](CHANGELOG.md) for an overview of the changes.
-[Tested](https://travis-ci.org/mongoid/mongoid-locker) against:
-- MRI: `2.3.8`, `2.4.7`, `2.5.7`, `2.6.6`, `2.7.1`
+[Tested](https://github.com/mongoid/mongoid-locker/actions) against:
+- MRI: `2.3.8`, `2.4.7`, `2.5.7`, `2.6.6`, `2.7.1`, `3.0.5`, `3.1.3`
- JRuby `9.1.17.0`, `9.2.11.1`
-- Mongoid: `5`, `6`, `7`
+- Mongoid: `5`, `6`, `7`, `8`
-See [.travis.yml](.travis.yml) for the latest test matrix.
+See [.github/workflows/test.yml](.github/workflows/test.yml) for the latest test matrix.
## Usage
Add to your `Gemfile`:
@@ -35,11 +36,9 @@
field :locking_name, type: String
field :locked_at, type: Time
field :age, type: Integer
-
- index({ _id: 1, locking_name: 1 }, name: 'mongoid_locker_index', sparse: true, unique: true, expire_after_seconds: lock_timeout)
end
```
Then, execute any code you like in a block like so: