influxdb 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3dbf2a3bd000d956cd08c67f935e5e9b80b7d03
4
- data.tar.gz: 140163253ece45b18b0a1d4a371a9c7062c70285
3
+ metadata.gz: ef1ebbbcacc05c56d8bbabdbd22848361b6ac3f6
4
+ data.tar.gz: 737cc1c7fb163655ccec58afdb6261084646b620
5
5
  SHA512:
6
- metadata.gz: 3d769deb45adc98a3ab185606b309f887c82e160ef0c58a0090d00892b9dfdce4dbeff7c7965e31c86d45d5122f87bdc23eb7c637abc56e03763f1a6013747fe
7
- data.tar.gz: a4f6ffa3cb9371424696df45d3a9657b67c7b226e7b585f52334cc415fa792f6f41c52700d59f80afdcfdabca06cf2f9d76264f6947c7f512cdb65887778c28d
6
+ metadata.gz: 4c1e764c646a040c133c7bf9f2ce299fee0da7091a872437ee2586de8496aea944d9994f57aa3b83c30e4cb0ebf297cf69b4e4cbb910d99a1da2cb5b8218cee5
7
+ data.tar.gz: c753626ee6dde17ed931febfe12656e5d7c3c5ab380ad333f28930d464808595805d12649e908383cf2d7287e9281a17f8b1826f236d912c95aa51ea73c5da59
@@ -4,6 +4,12 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/
4
4
 
5
5
  ## Unreleased changes
6
6
 
7
+ - None.
8
+
9
+ ## v0.5.2, released 2017-11-28
10
+
11
+ - Add async option to block on full queue (#209, @davemt)
12
+
7
13
  ## v0.5.1, released 2017-10-31
8
14
 
9
15
  - Add support for `SHARD DURATION` in retention policy (#203, @ljagiello)
data/README.md CHANGED
@@ -157,7 +157,7 @@ influxdb.write_point(name, data, time_precision)
157
157
  >
158
158
  > ```ruby
159
159
  > influxdb = InfluxDB::Client.new time_precision: "ms"
160
- > time = (Time.now.to_r * 10**6).to_i
160
+ > time = (Time.now.to_r * 1000).to_i
161
161
  > influxdb.write_point("foobar", { values: { n: 42 }, timestamp: time })
162
162
  > ```
163
163
 
@@ -282,14 +282,16 @@ Using `async: true` is a shortcut for the following:
282
282
  ``` ruby
283
283
  async_options = {
284
284
  # number of points to write to the server at once
285
- max_post_points: 1000,
285
+ max_post_points: 1000,
286
286
  # queue capacity
287
- max_queue_size: 10_000,
287
+ max_queue_size: 10_000,
288
288
  # number of threads
289
- num_worker_threads: 3,
289
+ num_worker_threads: 3,
290
290
  # max. time (in seconds) a thread sleeps before
291
291
  # checking if there are new jobs in the queue
292
- sleep_interval: 5
292
+ sleep_interval: 5,
293
+ # whether client will block if queue is full
294
+ block_on_full_queue: false
293
295
  }
294
296
 
295
297
  influxdb = InfluxDB::Client.new database, async: async_options
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.5.1".freeze
2
+ VERSION = "0.5.2".freeze
3
3
  end
@@ -34,7 +34,8 @@ module InfluxDB
34
34
  :max_post_points,
35
35
  :max_queue_size,
36
36
  :num_worker_threads,
37
- :sleep_interval
37
+ :sleep_interval,
38
+ :block_on_full_queue
38
39
 
39
40
  include InfluxDB::Logging
40
41
 
@@ -42,17 +43,20 @@ module InfluxDB
42
43
  MAX_QUEUE_SIZE = 10_000
43
44
  NUM_WORKER_THREADS = 3
44
45
  SLEEP_INTERVAL = 5
46
+ BLOCK_ON_FULL_QUEUE = false
45
47
 
46
48
  def initialize(client, config)
47
49
  @client = client
48
50
  config = config.is_a?(Hash) ? config : {}
49
51
 
50
- @max_post_points = config.fetch(:max_post_points, MAX_POST_POINTS)
51
- @max_queue_size = config.fetch(:max_queue_size, MAX_QUEUE_SIZE)
52
- @num_worker_threads = config.fetch(:num_worker_threads, NUM_WORKER_THREADS)
53
- @sleep_interval = config.fetch(:sleep_interval, SLEEP_INTERVAL)
52
+ @max_post_points = config.fetch(:max_post_points, MAX_POST_POINTS)
53
+ @max_queue_size = config.fetch(:max_queue_size, MAX_QUEUE_SIZE)
54
+ @num_worker_threads = config.fetch(:num_worker_threads, NUM_WORKER_THREADS)
55
+ @sleep_interval = config.fetch(:sleep_interval, SLEEP_INTERVAL)
56
+ @block_on_full_queue = config.fetch(:block_on_full_queue, BLOCK_ON_FULL_QUEUE)
54
57
 
55
- @queue = InfluxDB::MaxQueue.new max_queue_size
58
+ queue_class = @block_on_full_queue ? SizedQueue : InfluxDB::MaxQueue
59
+ @queue = queue_class.new max_queue_size
56
60
 
57
61
  spawn_threads!
58
62
  end
@@ -86,10 +86,11 @@ describe InfluxDB::Client do
86
86
  describe "async options" do
87
87
  let(:async_options) do
88
88
  {
89
- max_post_points: 10,
90
- max_queue_size: 100,
91
- num_worker_threads: 1,
92
- sleep_interval: 0.5
89
+ max_post_points: 10,
90
+ max_queue_size: 100,
91
+ num_worker_threads: 1,
92
+ sleep_interval: 0.5,
93
+ block_on_full_queue: false
93
94
  }
94
95
  end
95
96
 
@@ -100,5 +101,7 @@ describe InfluxDB::Client do
100
101
  specify { expect(subject.max_queue_size).to be 100 }
101
102
  specify { expect(subject.num_worker_threads).to be 1 }
102
103
  specify { expect(subject.sleep_interval).to be_within(0.0001).of(0.5) }
104
+ specify { expect(subject.block_on_full_queue).to be false }
105
+ specify { expect(subject.queue).to be_kind_of(InfluxDB::MaxQueue) }
103
106
  end
104
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Persen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-31 00:00:00.000000000 Z
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler