herdst_worker 0.1.10 → 0.1.13

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: 6754dcab06ceedfa472bae8e9f36308d5b72865ed9d49c9b50119c923ad7f33a
4
- data.tar.gz: 52d94cf004fb6e482d19b0f1ad254dc1c19a6069fc97e27c758414e38e496b41
3
+ metadata.gz: '02193d09ac1bb8582882d36e937425623cf00768c1be911be7a857609e889099'
4
+ data.tar.gz: 8ce2b6a8f69a84daf820ff98510f3f20f8544108ab64f4a2fc0a0795fad2c846
5
5
  SHA512:
6
- metadata.gz: 923627aabe68609ac0378cbf90ff33ef96d583902100d8537a6fbfb5cf8dd5c850f888c22d3e2f4a30a0e744c4ceea64cd73d62c7b41b31738c0517f5a53bc2e
7
- data.tar.gz: 42b2742887f6a3db02a715acecee2203b8c787dd4be04bd57320b21fe28d60a1a684b13f7d599da5fde55473f5841679a6e3d55f1e1d8a743cd2a6d6338f8575
6
+ metadata.gz: 2dfb5f43c264f4c3c28304e64948603bd4e817b947b04f5adf7d29c588624b3ca9f4ef0f67e13490965e11350d0bb955a4cd7f25791e2c66dd34f2127090a137
7
+ data.tar.gz: a74f224e8782bbfab17d1a2ffb2f579a281ef3a7077e3e3b26621c29eb188d080407c4ac5c3fe886bdd380b66eac74e4aec2af2760873452d0bf86be026cadc6
@@ -4,6 +4,8 @@ module HerdstWorker
4
4
 
5
5
 
6
6
  def self.setup(app)
7
+ ActiveRecord::Base.default_timezone = :utc
8
+
7
9
  begin
8
10
  if app.config.is_dev?
9
11
  ActiveRecord::Base.logger = app.logger.activerecord
@@ -15,7 +17,6 @@ module HerdstWorker
15
17
  end
16
18
 
17
19
  ActiveRecord::Base.configurations = db_config.values
18
- ActiveRecord::Base.default_timezone = :utc
19
20
  ActiveRecord::Base.establish_connection(db_config[:primary])
20
21
  ActiveRecord::Base.connection.enable_query_cache!
21
22
  rescue Exception => ex
@@ -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,7 +94,7 @@ 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
@@ -120,15 +125,10 @@ module HerdstWorker
120
125
 
121
126
 
122
127
  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
128
+ def fail_action_permanently(ex, data)
129
+ ex_message = ex ? ex.message : nil
130
+
131
+ self.app.logger.queue.error "Message failed permanently: #{ex_message}"
132
132
  end
133
133
 
134
134
 
@@ -1,3 +1,3 @@
1
1
  module HerdstWorker
2
- VERSION = '0.1.10'
2
+ VERSION = '0.1.13'
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.10
4
+ version: 0.1.13
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-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport