culturecode_stagehand 0.12.6 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21588d2db73e04fad644f7881621dca9b8d7c232
4
- data.tar.gz: 0ecfac94c7dae7caaa0449ff3d2ac58b393e665b
3
+ metadata.gz: ef4f7ed707fdd603dee78f606e921ad59fbdf1ae
4
+ data.tar.gz: bb179ffa8b7e83eebc77f8588b3391b7da3f9de9
5
5
  SHA512:
6
- metadata.gz: fa7858b0f8cd0f273d5965939160a658b3f9ffb0cf0979e8b484943dbed12a77915277656f982979de2bce2f3e9dfc0773cdcc3c129de85ef5aafdec36532e3f
7
- data.tar.gz: 57fe20163d08bc373c8793b23098007d6f7d0ef5696620431f50e40ad69eaccdb8022a7a1984675fcc8711ca97c2313535fd0e759bb3ddf33c709a3a7a444bd9
6
+ metadata.gz: 34f3b335af3dd3012fd2e5d4d25c4e92a2c050de854a2dbd2f8ef120280912816f622baed085e1d20f97ea9aea68c08f59700169f1fc9b6b404dc4ec3b5889e5
7
+ data.tar.gz: 2ef4879e631f9fc512eab292206ada48631707c3bec2a374611ca0c50927dfbe444fcdce42b578e6ccbc70e8fed429ca0bbeeee3fda72b7d1ce69ed83bebfd8b
@@ -14,6 +14,7 @@ module Stagehand
14
14
  t.string :operation, :null => false
15
15
  t.integer :commit_id
16
16
  t.string :session
17
+ t.datetime :created_at
17
18
  end
18
19
 
19
20
  add_index :stagehand_commit_entries, :commit_id # Used for looking up all entries within a commit
@@ -29,7 +29,7 @@ module Stagehand
29
29
  ON active_starts.session = #{table_name}.session AND active_starts.start_id <= #{table_name}.id")
30
30
  .where("active_starts.start_id IS NULL") }
31
31
  scope :with_uncontained_keys, lambda {
32
- joins("LEFT OUTER JOIN (#{ unscoped.contained.select('record_id, table_name').to_sql}) AS contained
32
+ joins("LEFT OUTER JOIN (#{ unscoped.contained.select('record_id, table_name').distinct.to_sql}) AS contained
33
33
  ON contained.record_id = #{table_name}.record_id AND contained.table_name = #{table_name}.table_name")
34
34
  .where("contained.record_id IS NULL")
35
35
  }
@@ -83,15 +83,13 @@ module Stagehand
83
83
  # Lazily iterate through millions of commit entries
84
84
  # Returns commit entries in ID descending order
85
85
  def iterate_autosyncable_entries(&block)
86
- session_list = CommitEntry.order(:id => :desc).distinct.pluck(:session)
87
-
88
- while sessions = session_list.shift(SESSION_BATCH_SIZE).presence
89
- offset = 0
90
- while entries = autosyncable_entries(:session => sessions).offset(offset).limit(BATCH_SIZE).uniq(&:id).presence
91
- offset += BATCH_SIZE
92
- entries.each do |entry|
93
- with_confirmed_autosyncability(entry, &block)
94
- end
86
+ max = CommitEntry.maximum(:id)
87
+ min = CommitEntry.minimum(:id)
88
+
89
+ max.step(min, -BATCH_SIZE).each do |current|
90
+ range = [current - BATCH_SIZE, min].max..current
91
+ autosyncable_entries(:id => range).uniq(&:id).each do |entry|
92
+ with_confirmed_autosyncability(entry, &block)
95
93
  end
96
94
  end
97
95
  end
@@ -1,3 +1,3 @@
1
1
  module Stagehand
2
- VERSION = "0.12.6"
2
+ VERSION = "0.12.7"
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.12.6
4
+ version: 0.12.7
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: 2017-01-30 00:00:00.000000000 Z
12
+ date: 2017-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails