rhosync 2.1.17.beta1 → 2.1.17.beta2
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.
- data/CHANGELOG +2 -0
- data/lib/rhosync/client_sync.rb +11 -21
- data/lib/rhosync/version.rb +1 -1
- data/spec/client_sync_spec.rb +13 -12
- metadata +4 -4
data/CHANGELOG
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* #27612327 - Bulk Sync Not Returning Errors from Zendesk ticket #2336
|
|
6
6
|
* #28219647 - Schema Change Error from Zendesk ticket #2353
|
|
7
7
|
* #28328057 - Feature Request: Adding a Bulk Data Job after_perform hook from Zendesk ticket #2367
|
|
8
|
+
* Empty cud hash to trigger processing of the queued data (Zendesk #2383)
|
|
9
|
+
* Revert fix for Zendesk ticket #2336 by customer request
|
|
8
10
|
|
|
9
11
|
## 2.1.16
|
|
10
12
|
* 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)
|
data/lib/rhosync/client_sync.rb
CHANGED
|
@@ -15,13 +15,18 @@ module Rhosync
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def receive_cud(cud_params={},query_params=nil)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
23
29
|
end
|
|
24
|
-
@source_sync.process_cud(@client.id) if processed > 0
|
|
25
30
|
end
|
|
26
31
|
|
|
27
32
|
def send_cud(token=nil,query_params=nil)
|
|
@@ -256,21 +261,6 @@ module Rhosync
|
|
|
256
261
|
|
|
257
262
|
if data and data.completed? and data.dbfiles_exist?
|
|
258
263
|
client.update_clientdoc(sources)
|
|
259
|
-
sources.each do |src|
|
|
260
|
-
s = Source.load(src, {:user_id => client.user_id, :app_id => client.app_id})
|
|
261
|
-
errordoc = s.docname(:errors)
|
|
262
|
-
errors = {}
|
|
263
|
-
Store.lock(errordoc) do
|
|
264
|
-
errors = Store.get_data(errordoc)
|
|
265
|
-
end
|
|
266
|
-
unless errors.empty?
|
|
267
|
-
# FIXME: :result => :bulk_sync_error, :errors => "#{errors}"
|
|
268
|
-
log "Bulk sync errors are found in #{src}: #{errors}"
|
|
269
|
-
# Delete all related bulk files
|
|
270
|
-
data.delete_files
|
|
271
|
-
return {:result => :url, :url => ''}
|
|
272
|
-
end
|
|
273
|
-
end
|
|
274
264
|
{:result => :url, :url => data.url}
|
|
275
265
|
elsif data
|
|
276
266
|
{:result => :wait}
|
data/lib/rhosync/version.rb
CHANGED
data/spec/client_sync_spec.rb
CHANGED
|
@@ -25,6 +25,19 @@ describe "ClientSync" do
|
|
|
25
25
|
@cs.client.docname(:update) => {},
|
|
26
26
|
@cs.client.docname(:delete) => {})
|
|
27
27
|
end
|
|
28
|
+
|
|
29
|
+
it "should handle receive cud that triggers processing of the previously queued data" do
|
|
30
|
+
params = {'create'=>{'1'=>@product1},'update'=>{'2'=>@product2},'delete'=>{'3'=>@product3}}
|
|
31
|
+
queued_create_data = {'1'=>@product1}
|
|
32
|
+
set_state(@c.docname(:create) => queued_create_data)
|
|
33
|
+
verify_result(@cs.client.docname(:create) => queued_create_data,
|
|
34
|
+
@cs.client.docname(:update) => {},
|
|
35
|
+
@cs.client.docname(:delete) => {})
|
|
36
|
+
@cs.receive_cud({})
|
|
37
|
+
verify_result(@cs.client.docname(:create) => {},
|
|
38
|
+
@cs.client.docname(:update) => {},
|
|
39
|
+
@cs.client.docname(:delete) => {})
|
|
40
|
+
end
|
|
28
41
|
|
|
29
42
|
it "should handle send cud" do
|
|
30
43
|
data = {'1'=>@product1,'2'=>@product2}
|
|
@@ -594,18 +607,6 @@ describe "ClientSync" do
|
|
|
594
607
|
"source:#{@a_fields[:name]}:#{@u_fields[:login]}:#{@s_fields[:name]}:md" => @data,
|
|
595
608
|
"source:#{@a_fields[:name]}:#{@u_fields[:login]}:#{@s_fields[:name]}:md_copy" => @data)
|
|
596
609
|
end
|
|
597
|
-
|
|
598
|
-
it "should return empty bulk data url if there are errors in query" do
|
|
599
|
-
ClientSync.bulk_data(:user,@c)
|
|
600
|
-
BulkDataJob.perform("data_name" => bulk_data_docname(@a.id,@u.id))
|
|
601
|
-
BulkDataJob.after_perform_x("data_name" => bulk_data_docname(@a.id,@u.id))
|
|
602
|
-
errordoc = @s.docname(:errors) # source SampleAdapter
|
|
603
|
-
operation = 'query'
|
|
604
|
-
Store.lock(errordoc) do
|
|
605
|
-
Store.put_data(errordoc,{"#{operation}-error"=>{'message'=>"Some exception message"}}, true)
|
|
606
|
-
end
|
|
607
|
-
ClientSync.bulk_data(:user,@c).should == {:result => :url, :url => ''}
|
|
608
|
-
end
|
|
609
610
|
|
|
610
611
|
it "should escape bulk data url" do
|
|
611
612
|
name = 'a b'
|
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:
|
|
4
|
+
hash: 4099760631
|
|
5
5
|
prerelease: 7
|
|
6
6
|
segments:
|
|
7
7
|
- 2
|
|
8
8
|
- 1
|
|
9
9
|
- 17
|
|
10
10
|
- beta
|
|
11
|
-
-
|
|
12
|
-
version: 2.1.17.
|
|
11
|
+
- 2
|
|
12
|
+
version: 2.1.17.beta2
|
|
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-
|
|
20
|
+
date: 2012-04-27 00:00:00 Z
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|
|
23
23
|
name: sinatra
|