rservicebus2 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rservicebus2/monitor/awss3.rb +10 -32
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 977c2ab9f328770086dc29090e1d06def2037e763e872debc8bcbf9c1050e96c
|
4
|
+
data.tar.gz: 0565acd0857455a423c012e6b9f08dc155018c39adf6387642623684adbaaa07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 596ef0eaed4a2462e324efcda720784bd96fde172975647bd48854c435b97b139029e8e3b5531451cd7e7df2a5a73d9116aa51c19c9bc10ecb55b0a8e9584436
|
7
|
+
data.tar.gz: 7fbad671a58644b047341c89f4ab54abf50856a82eadc6bfee121465cea6dbec83f81c59e35f5431c410f2e80ad7aedb9e97537ce35e81172ccf92488720c68b
|
@@ -17,56 +17,34 @@ module RServiceBus2
|
|
17
17
|
content
|
18
18
|
end
|
19
19
|
|
20
|
-
# rubocop:disable Metrics/MethodLength
|
21
|
-
def read_content_from_file(file_path)
|
22
|
-
content = ''
|
23
|
-
if @input_filter.length > 0
|
24
|
-
if @input_filter[0] == 'ZIP'
|
25
|
-
content = read_content_from_zip_file(file_path)
|
26
|
-
elsif @input_filter[0] == 'GZ'
|
27
|
-
content = read_content_from_gz_file(file_path)
|
28
|
-
elsif @input_filter[0] == 'TAR'
|
29
|
-
fail 'TAR reader not implemented'
|
30
|
-
end
|
31
|
-
|
32
|
-
else
|
33
|
-
content = IO.read(file_path)
|
34
|
-
end
|
35
|
-
|
36
|
-
content
|
37
|
-
end
|
38
|
-
|
39
20
|
def process_path(object_key)
|
40
21
|
# content = read_content_from_object(object_key)
|
41
|
-
|
22
|
+
resp = @s3_client.get_object(bucket: @bucket_name, key: object_key)
|
23
|
+
|
24
|
+
# call #read or #string on the response body
|
25
|
+
content = resp.body.read
|
42
26
|
payload = process_content(content)
|
43
27
|
|
44
|
-
send(payload, URI.parse(
|
28
|
+
send(payload, URI.parse(CGI.escape("s3://#{@region}/#{@bucket_name}/#{object_key}")))
|
29
|
+
|
30
|
+
@s3_client.delete_object({ bucket: @bucket_name, key: object_key })
|
31
|
+
|
45
32
|
content
|
46
33
|
end
|
47
34
|
|
48
35
|
def look
|
49
36
|
file_processed = 0
|
50
|
-
max_files_processed =
|
37
|
+
max_files_processed = 2
|
51
38
|
|
52
|
-
objects = @s3_client.list_objects_v2(
|
53
|
-
bucket: @bucket_name,
|
54
|
-
max_keys: max_files_processed
|
55
|
-
).contents
|
56
|
-
|
57
|
-
return if objects.count.zero?
|
39
|
+
objects = @s3_client.list_objects_v2( bucket: @bucket_name, max_keys: max_files_processed).contents
|
58
40
|
|
59
41
|
objects.each do |object|
|
60
42
|
RServiceBus2.log "Ready to process, #{object.key}"
|
61
43
|
process_path(object.key)
|
62
|
-
# content = process_path(object.key)
|
63
|
-
|
64
|
-
# File.unlink(file_path)
|
65
44
|
|
66
45
|
file_processed += 1
|
67
46
|
RServiceBus2.log "Processed #{file_processed} of #{objects.length}."
|
68
47
|
RServiceBus2.log "Allow system tick #{self.class.name}"
|
69
|
-
break if file_processed >= max_files_processed
|
70
48
|
end
|
71
49
|
end
|
72
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rservicebus2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Irvine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uuidtools
|