Skip to content

Commit f4e41ec

Browse files
committed
Merge branch 'development'
2 parents 3764cc9 + 0b2b2de commit f4e41ec

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
4.2.1 (July 20, 2017)
2+
- Coerce string to regexp for Regexp matcher
3+
14
4.2.0 (July 18, 2017)
25
- Add new boolean/regexp matchers
36
- Add support for split dependency on other splits

Detailed-README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,22 +424,41 @@ Currently SDK supports:
424424

425425
Other servers should work fine as well, but haven't been tested.
426426

427-
### Unicorn
427+
### Unicorn and Puma in cluster mode (only for "memory mode")
428428

429-
If you're using Unicorn in the `memory` mode you'll need to include this line in your unicorn config (probably `config/unicorn.rb`):
429+
During the start of your application SDK spawns multiple threads, each thread has an infinite loop inside which is used to fetch splits/segments or send impressions/metrics.
430+
Several servers like Unicorn and Puma in cluster mode (i.e. with `workers` > 0) spawn multiple child processes, but when child process is spawn it does not recreate threads, which existed in the parent process, that's why if you use Unicorn or Puma in cluster mode you need to make two small extra steps.
431+
432+
For both servers you will need to have the following line in your `config/initializers/splitclient.rb`:
433+
434+
```ruby
435+
Rails.configuration.split_factory = factory
436+
```
437+
438+
#### Unicorn
439+
440+
If you're using Unicorn you'll need to include this line in your Unicorn config (probably `config/unicorn.rb`):
430441

431442
```ruby
432443
after_fork do |server, worker|
433444
Rails.configuration.split_factory.resume! if worker.nr > 0
434445
end
435446
```
436447

437-
Also, you will need to have the following line in your `config/initializers/splitclient.rb`:
448+
By doing that SDK will recreate threads for each new worker, besides master.
449+
450+
#### Puma
451+
452+
For those who use Puma in cluster mode add this to your Puma config (probably `config/puma.rb`):
438453

439454
```ruby
440-
Rails.configuration.split_factory = factory
455+
on_worker_boot do |worker_number|
456+
Rails.configuration.split_factory.resume! if worker_number.nr > 0
457+
end
441458
```
442459

460+
By doing that SDK will recreate threads for each new worker, besides master.
461+
443462
## Framework support
444463

445464
Currently SDK supports:

lib/splitclient-rb/engine/matchers/matches_string_matcher.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ def self.matcher_type
66

77
def initialize(attribute, regexp_string)
88
@attribute = attribute
9-
@regexp_string = regexp_string
9+
@regexp_string = @regexp_string.is_a?(Regexp) ? regexp_string : Regexp.new(regexp_string)
1010
end
1111

1212
def match?(_matching_key, _bucketing_key, _evaluator, data)
1313
value = data.fetch(@attribute) { |attr| data[attr.to_s] || data[attr.to_sym] }
1414

15-
if @regexp_string.is_a? Regexp
16-
(value =~ @regexp_string) != nil
17-
else
18-
# String here
19-
value == @regexp_string
20-
end
15+
(value =~ @regexp_string) != nil
2116
end
2217
end
2318
end

lib/splitclient-rb/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module SplitIoClient
2-
VERSION = '4.2.0'
2+
VERSION = '4.2.1'
33
end

0 commit comments

Comments
 (0)