rhosync 2.1.17.beta2 → 2.1.17.beta3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -7,6 +7,7 @@
7
7
  * #28328057 - Feature Request: Adding a Bulk Data Job after_perform hook from Zendesk ticket #2367
8
8
  * Empty cud hash to trigger processing of the queued data (Zendesk #2383)
9
9
  * Revert fix for Zendesk ticket #2336 by customer request
10
+ * #28094895 - Zendesk ticket #2354: Bulk sync not updating sources table (fields 'last_inserted_size' and 'backend_refresh_time' now updated)
10
11
 
11
12
  ## 2.1.16
12
13
  * revert rack support for v. 1.4.1 and lock to v. 1.3.6 due to problems with Heroku deployment (Rack 1.4.1 produces 502 error)
@@ -15,18 +15,13 @@ module Rhosync
15
15
  end
16
16
 
17
17
  def receive_cud(cud_params={},query_params=nil)
18
- # empty hash - means enforce processing of the queue
19
- if cud_params.size == 0
20
- @source_sync.process_cud(@client.id)
21
- else
22
- _process_blobs(cud_params)
23
- processed = 0
24
- ['create','update','delete'].each do |op|
25
- key,value = op,cud_params[op]
26
- processed += _receive_cud(key,value) if value
27
- end
28
- @source_sync.process_cud(@client.id) if processed > 0
18
+ _process_blobs(cud_params)
19
+ processed = 0
20
+ ['create','update','delete'].each do |op|
21
+ key,value = op,cud_params[op]
22
+ processed += _receive_cud(key,value) if value
29
23
  end
24
+ @source_sync.process_cud(@client.id)
30
25
  end
31
26
 
32
27
  def send_cud(token=nil,query_params=nil)
@@ -134,21 +134,25 @@ module Rhosync
134
134
  end
135
135
  str[0..-2]
136
136
  end
137
-
137
+
138
+ # #2354: Bulk sync not updating sources table
139
+ # last_inserted_size +
140
+ # last_deleted_size
141
+ # backend_refresh_time +
138
142
  def self.populate_sources_table(db,sources_refs)
139
143
  db.transaction do |database|
140
144
  database.prepare("insert into sources
141
- (source_id,name,sync_priority,partition,sync_type,source_attribs,metadata,schema,blob_attribs,associations)
142
- values (?,?,?,?,?,?,?,?,?,?)") do |stmt|
145
+ (source_id,name,sync_priority,partition,sync_type,source_attribs,metadata,schema,blob_attribs,associations,last_inserted_size,backend_refresh_time)
146
+ values (?,?,?,?,?,?,?,?,?,?,?,?)") do |stmt|
143
147
  sources_refs.each do |source_name,ref|
144
148
  s = ref[:source]
145
149
  stmt.execute(s.source_id,s.name,s.priority,s.partition_type.to_s,
146
- s.sync_type.to_s,refs_to_s(ref[:refs]),s.get_value(:metadata),s.schema,s.blob_attribs,s.has_many)
150
+ s.sync_type.to_s,refs_to_s(ref[:refs]),s.get_value(:metadata),s.schema,s.blob_attribs,s.has_many,s.get_value(:md_size),s.read_state.refresh_time)
147
151
  end
148
152
  end
149
153
  end
150
154
  end
151
-
155
+
152
156
  def self.create_sqlite_data_file(bulk_data,ts)
153
157
  sources_refs = {}
154
158
  schema,index,bulk_data.dbfile = get_file_args(bulk_data.name,ts)
@@ -1,3 +1,3 @@
1
1
  module Rhosync
2
- VERSION = '2.1.17.beta2'
2
+ VERSION = '2.1.17.beta3'
3
3
  end
@@ -33,7 +33,7 @@ describe "ClientSync" do
33
33
  verify_result(@cs.client.docname(:create) => queued_create_data,
34
34
  @cs.client.docname(:update) => {},
35
35
  @cs.client.docname(:delete) => {})
36
- @cs.receive_cud({})
36
+ @cs.receive_cud({:source_name => @s_fields[:name]})
37
37
  verify_result(@cs.client.docname(:create) => {},
38
38
  @cs.client.docname(:update) => {},
39
39
  @cs.client.docname(:delete) => {})
data/spec/spec_helper.rb CHANGED
@@ -115,8 +115,8 @@ module TestHelpers
115
115
  end
116
116
 
117
117
  def validate_db_by_name(db,s,data)
118
- db.execute("select source_id,name,sync_priority,partition,
119
- sync_type,source_attribs,metadata,schema,blob_attribs,associations
118
+ db.execute("select source_id,name,sync_priority,partition,sync_type,source_attribs,
119
+ metadata,schema,blob_attribs,associations,last_inserted_size, backend_refresh_time
120
120
  from sources where name='#{s.name}'").each do |row|
121
121
  return false if row[0].to_s != s.source_id.to_s
122
122
  return false if row[1] != s.name
@@ -128,6 +128,8 @@ module TestHelpers
128
128
  return false if row[7] != s.schema
129
129
  return false if row[8] != s.blob_attribs
130
130
  return false if row[9] != s.has_many
131
+ return false if row[10] != s.get_value(:md_size).to_i
132
+ return false if row[11] != s.read_state.refresh_time
131
133
  end
132
134
 
133
135
  data = json_clone(data)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhosync
3
3
  version: !ruby/object:Gem::Version
4
- hash: 4099760631
4
+ hash: 2250687
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
9
  - 17
10
10
  - beta
11
- - 2
12
- version: 2.1.17.beta2
11
+ - 3
12
+ version: 2.1.17.beta3
13
13
  platform: ruby
14
14
  authors:
15
15
  - Rhomobile
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-04-27 00:00:00 Z
20
+ date: 2012-05-01 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: sinatra
@@ -582,7 +582,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
582
582
  requirements: []
583
583
 
584
584
  rubyforge_project:
585
- rubygems_version: 1.8.20
585
+ rubygems_version: 1.8.24
586
586
  signing_key:
587
587
  specification_version: 3
588
588
  summary: RhoSync Synchronization Framework