README.md in sidekiq-lock-0.0.1 vs README.md in sidekiq-lock-0.2.0

- old
+ new

@@ -1,9 +1,12 @@ # Sidekiq::Lock [![Code Climate](https://codeclimate.com/github/emq/sidekiq-lock.png)](https://codeclimate.com/github/emq/sidekiq-lock) [![Build Status](https://travis-ci.org/emq/sidekiq-lock.png?branch=master)](https://travis-ci.org/emq/sidekiq-lock) +[![Coverage Status](https://coveralls.io/repos/emq/sidekiq-lock/badge.png)](https://coveralls.io/r/emq/sidekiq-lock) +[![Dependency Status](https://gemnasium.com/emq/sidekiq-lock.png)](https://gemnasium.com/emq/sidekiq-lock) +[![Gem Version](https://badge.fury.io/rb/sidekiq-lock.png)](http://badge.fury.io/rb/sidekiq-lock) Redis-based simple locking mechanism for [sidekiq][2]. Uses [SET command][1] introduced in Redis 2.6.16. It can be handy if you push a lot of jobs into the queue(s), but you don't want to execute specific jobs at the same time - it provides a `lock` method that you can use in whatever way you want. @@ -87,9 +90,26 @@ end end ``` Just be sure to provide valid redis key as a lock name. + +### Customizing lock method name + +You can change `lock` to something else (globally) in sidekiq server configuration: + +``` ruby +Sidekiq.configure_server do |config| + config.lock_method = :redis_lock +end +``` + +### Inline testing + +As you know middleware is not invoked when testing jobs inline, you can require in your test/spec helper file `sidekiq/lock/testing/inline` to include two methods that will help you setting / clearing up lock manually: + +- `set_sidekiq_lock(worker_class, payload)` - note: payload should be an array of worker arguments +- `clear_sidekiq_lock` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`)