herdst_worker 0.1.11 → 0.1.14

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
  SHA256:
3
- metadata.gz: 6b6b9a0d96a5006442a1575169588704eadbadef89218f89962970f61e4a0172
4
- data.tar.gz: 7f64060a9d13882974ce5a977a048371b8b00c898b9c0f1eae04c5e879e384ad
3
+ metadata.gz: a8ee87eb31076a5197533170b8cc692ca76281d962a0e296f8ed88bbc535e1af
4
+ data.tar.gz: 436409adc17f62f031236eb19d9bd536dc8538b37f435e0853a2c61637896b9a
5
5
  SHA512:
6
- metadata.gz: ac149ff031d7504cb7584ad8535b3cf4f7d6727cc9c1a342268219b84aeba0db3e45c055491d1ba44d97fdce842878733266a94a2e9bd8da2961471c3a62867a
7
- data.tar.gz: 7d2ee10d17bcfa82279b098da8de0bfc81a63dbc9fc13a82561fc1e70722b9e4666d80a1ec7bf3706df09139d9c7ee2ca5ba63b8f6327f151a0c3d201897cfef
6
+ metadata.gz: 750580eba97495e1dcacaeefb309ba4fb60d1562f3235903c0f0ee345301bc145704969beb336515b3ed75890f0b75b8511a305065a4b70ddd096e0f92ed163c
7
+ data.tar.gz: c76aece17773f0cf7e9847f1557734835ffaffac2a335a07a11d8480a8418d937481182cdc2ea74373d36640623c0f57724aba4bbb6ed4a7b06f6db71b0b95bd
@@ -60,7 +60,7 @@ module HerdstWorker
60
60
  data_source = record["eventSource"].split(":")
61
61
  data_origin = data_source.first
62
62
  data_operation = data_source.last
63
- record_data = record[data_operation]
63
+ record_data = record[data_operation]
64
64
  company_id = nil
65
65
  user_id = nil
66
66
 
@@ -68,6 +68,11 @@ module HerdstWorker
68
68
  record_data["sentTimestamp"] = sent_timestamp
69
69
  record_data["triggerTimestamp"] = trigger_timestamp || sent_timestamp
70
70
 
71
+ # Id the event origin is s3 and an object was created overwrite the configuration ID
72
+ if data_origin == "aws" && data_operation == "s3" && record["eventName"] == "ObjectCreated:Put"
73
+ record_data["configurationId"] = "objectCreated"
74
+ end
75
+
71
76
  execution_data << record_data
72
77
 
73
78
  if data_origin === "application" and record.include? "userIdentity"
@@ -89,13 +94,26 @@ module HerdstWorker
89
94
  return Concurrent::Promise.new {} if execution_promise == nil
90
95
  return execution_promise.rescue { |ex|
91
96
  execution_data.each do |data|
92
- fail_action_permanently(data) if will_fail_permanently
97
+ fail_action_permanently(ex, data) if will_fail_permanently
93
98
  end
94
99
 
95
100
  raise ex
96
101
  }
97
102
  end
98
103
 
104
+ if message["source"] != nil and message["source"].starts_with?("aws.")
105
+ action_name = message["source"].split(".").last
106
+
107
+ message_record = message.dup
108
+ message_record["configurationId"] = "Event#{action_name.camelize}"
109
+ message_record["sentTimestamp"] = sent_timestamp
110
+ message_record["triggerTimestamp"] = trigger_timestamp || sent_timestamp
111
+
112
+ return Concurrent::Promise.new {
113
+ execute_message!(nil, nil, message_record)
114
+ }
115
+ end
116
+
99
117
  return Concurrent::Promise.new {}
100
118
  end
101
119
 
@@ -120,15 +138,10 @@ module HerdstWorker
120
138
 
121
139
 
122
140
  protected
123
- def fail_action_permanently(data)
124
- if data.include? "action_id"
125
- # action = Action.get(data["action_id"])
126
- #
127
- # if action
128
- # action.update_data({ :stats => nil, :errors => nil }, :errored)
129
- # action.cleanup
130
- # end
131
- end
141
+ def fail_action_permanently(ex, data)
142
+ ex_message = ex ? ex.message : nil
143
+
144
+ self.app.logger.queue.error "Message failed permanently: #{ex_message}"
132
145
  end
133
146
 
134
147
 
@@ -1,3 +1,3 @@
1
1
  module HerdstWorker
2
- VERSION = '0.1.11'
2
+ VERSION = '0.1.14'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herdst_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herd.St
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-05 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport