culturecode_stagehand 0.7.17 → 0.7.18

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: 48752d8e1806f8baad891a8ce01dd27dd7dff724
4
- data.tar.gz: ddae11cbab908b9068ee3ab8c4b3f1c77b069bd9
3
+ metadata.gz: 58df2083dd4f1a0fc7f3d4c1c1778d0acf941473
4
+ data.tar.gz: 20225cec28769c77e6a46ab8d012eff9a94ca10a
5
5
  SHA512:
6
- metadata.gz: 2261be0f7fad6f70c400861596e665a7a9fa671dbfa170843486c5ea6e810b571834bc927c8827773ea25a6536c3e59e8dd11e9188f4137552aba2a9234dec05
7
- data.tar.gz: 7fb87381e3fba33f2b64e223177052c45960a0ed5031853197876593dd30373b5a79c8c83ff0b66465321767e71c2d035a318e067c015bcb147f8dc24acdff9c
6
+ metadata.gz: cbc3a5779ace87420c2341ab705d727e4cb187717a8cdfb30e2d3a78ea19fb8d60b7d3ac96839f6a31915dd7036b0aa2c39dc35ea092c7c460dea0952a6ce686
7
+ data.tar.gz: 2dc328dced0b5f6207c59c08e49b573aee592818b13205fdf535ddf6db65c555fd89b2b08c1d8fff65426d6f4a3e8b85e15a49b27a2e1375d99387890afde386
@@ -5,6 +5,7 @@ module Stagehand
5
5
  mattr_accessor :schemas_match
6
6
 
7
7
  BATCH_SIZE = 1000
8
+ SESSION_BATCH_SIZE = 30
8
9
 
9
10
  # Immediately attempt to sync the changes from the block if possible
10
11
  # The block is wrapped in a transaction to prevent changes to records while being synced
@@ -72,14 +73,16 @@ module Stagehand
72
73
  # Lazily iterate through millions of commit entries
73
74
  # Returns commit entries in ID descending order
74
75
  def iterate_autosyncable_entries(&block)
75
- sessions = CommitEntry.order(:id => :desc).distinct.pluck(:session)
76
- offset = 0
77
-
78
- while sessions.present?
79
- autosyncable_entries(:session => sessions.shift(30)).offset(offset).limit(BATCH_SIZE).uniq(&:id).each do |entry|
80
- with_confirmed_autosyncability(entry, &block)
76
+ session_list = CommitEntry.order(:id => :desc).distinct.pluck(:session)
77
+
78
+ while sessions = session_list.shift(SESSION_BATCH_SIZE).presence
79
+ offset = 0
80
+ while entries = autosyncable_entries(:session => sessions).offset(offset).limit(BATCH_SIZE).uniq(&:id).presence
81
+ offset += BATCH_SIZE
82
+ entries.each do |entry|
83
+ with_confirmed_autosyncability(entry, &block)
84
+ end
81
85
  end
82
- offset += BATCH_SIZE
83
86
  end
84
87
  end
85
88
 
@@ -1,3 +1,3 @@
1
1
  module Stagehand
2
- VERSION = "0.7.17"
2
+ VERSION = "0.7.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: culturecode_stagehand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.17
4
+ version: 0.7.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Jakobsen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-01 00:00:00.000000000 Z
12
+ date: 2016-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails