flux_capacitor 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/lib/flux_capacitor/version.rb +1 -1
- data/lib/flux_capacitor.rb +1 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49cda02b4b59eeec057fe99708c69c9d33550ba7
|
4
|
+
data.tar.gz: 4106e315fe782950583290ac3c3e35e8b6227684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7aba405e5ccf1bf730e30eb3f873568b3de30ce4054fde39c01dfa5615c466f6908354509dd545ec37ab098ec34ae86471d5b05a6d194ebb133cbe514e1c7f6
|
7
|
+
data.tar.gz: 5c07cf434a1de885608a0fe5cbe2fa3b2f24a996be6de0df6e2f9104e1ff6e554669b1fe5df9ad2993a277b322ec45ade27f2bf53185ab4edf0201d5606680a6
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/flux_capacitor.svg)](https://badge.fury.io/rb/flux_capacitor)
|
2
2
|
|
3
|
-
|
3
|
+
# FluxCapacitor
|
4
4
|
|
5
|
-
|
5
|
+
Sometimes you want to change a feature or deploy a new feature but doing so all at once might take down some service. Enter Flux Capacitor. It allows you to gradually include more historical content in the new feature while allowing all future content to start out with the new feature already live.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -25,9 +25,11 @@ Or install it yourself as:
|
|
25
25
|
```ruby
|
26
26
|
require 'flux_capacitor'
|
27
27
|
|
28
|
-
pivot = DateTime.parse('2017/08/14 00:00:00-000') #
|
29
|
-
oldest = MyModel.first.created_at # If you are using active record finding your oldest item is pretty easy
|
30
|
-
|
28
|
+
pivot = DateTime.parse('2017/08/14 00:00:00-000') # when do you want to start rolling out the feature
|
29
|
+
oldest = MyModel.first.created_at # If you are using active record finding your oldest item is pretty easy
|
30
|
+
# otherwise if you know the date of your first item, just use that
|
31
|
+
end_point = DateTime.parse('2017/09/14') # The point where the feature is fully rolled out/safe to remove the Flux Capacitor.
|
32
|
+
# This dictates how quickly the feature rolls out. If you are concerned about overloading a required service set this to farther in the future
|
31
33
|
|
32
34
|
FEATURE_1_CAPACITOR = Flux::Capacitor.new(pivot, end_point, oldest)
|
33
35
|
|
data/lib/flux_capacitor.rb
CHANGED
@@ -5,10 +5,9 @@ require 'murmurhash3'
|
|
5
5
|
module Flux
|
6
6
|
|
7
7
|
class Capacitor
|
8
|
-
attr_reader :pivot, :
|
8
|
+
attr_reader :pivot, :time_dilation
|
9
9
|
def initialize (start_time, completion_target, oldest_target = Capacitor.oldest_string_time(start_time))
|
10
10
|
@pivot = start_time
|
11
|
-
@pivot_ts = pivot.strftime("%s").to_i
|
12
11
|
time_to_complete = seconds_between(completion_target, pivot)
|
13
12
|
dilation = seconds_between(pivot, oldest_target).to_f / time_to_complete.to_f
|
14
13
|
@time_dilation = dilation
|