rocketjob 6.2.0 → 6.3.1

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: d12a5469219af4b5781c67cf65670879f1fa349e42509431e5924015a52b4542
4
- data.tar.gz: 745bbcfb5cc47a3413edf874b088b81382ccc185218aac3648adb1250e51b803
3
+ metadata.gz: b8336e04f006f7f395a45c12f1456003e406791e83d56e305ed2358deb81d9c8
4
+ data.tar.gz: fc968d12498d87a462a7957138359853bba67b90251433a6e3688ca0a2c90752
5
5
  SHA512:
6
- metadata.gz: 012b3adb126e452c3ab4409d38d1fe02499cfc5049d5cc30074a1f607245e8da1327ad1a0a4b738ec290bcaf233cb7388132828d6f8f1684bdd70a1e17eb7c55
7
- data.tar.gz: f8a1899798671265395f72d259afce338bea6e555755c33fdfa11928e10b14f29cc868570caa39f091f6863fa3c8809ab8874a6ba81b8b210c36c63e4454cf2b
6
+ metadata.gz: 0e942f816fbbdef56b62aa996437f0087ff788521aa14f090de61ad91f8e1d46fa199ad7d9c7fd0b9faf0c4d18143af0f6cfb7665b591fd229bfc71bf25cd02b
7
+ data.tar.gz: 866b516729c28c67e0d2a8412bb3a4aee20f7ce7bd8e5664f998bbe97a398e10bc05986d194703c560e41e78de4c4b9bb1f03e33ff89b29894305bb510ea624f
@@ -226,7 +226,7 @@ module RocketJob
226
226
  result = self.class.with(write: {w: 1}) do |query|
227
227
  query.
228
228
  where(id: id, state: :running, sub_state: :processing).
229
- update("$set" => {sub_state: :after, worker_name: worker_name})
229
+ update("$set" => {sub_state: "after", worker_name: worker_name})
230
230
  end
231
231
 
232
232
  # Reload to pull in any counters or other data that was modified.
@@ -251,7 +251,7 @@ module RocketJob
251
251
  result = self.class.with(write: {w: 1}) do |query|
252
252
  query.
253
253
  where(id: id, state: :running, sub_state: :processing).
254
- update({"$set" => {state: :failed, worker_name: worker_name}})
254
+ update({"$set" => {state: "failed", worker_name: worker_name}})
255
255
  end
256
256
  fail_job = false unless result.modified_count.positive?
257
257
  end
@@ -61,7 +61,7 @@ module RocketJob
61
61
  @tabular ||= IOStreams::Tabular.new(
62
62
  columns: columns,
63
63
  format: format == :auto ? nil : format,
64
- format_options: format_options&.deep_symbolize_keys,
64
+ format_options: format_options&.to_h&.deep_symbolize_keys,
65
65
  file_name: file_name
66
66
  )
67
67
  end
@@ -99,7 +99,7 @@ module RocketJob
99
99
  @tabular ||= IOStreams::Tabular.new(
100
100
  columns: columns,
101
101
  format: format == :auto ? nil : format,
102
- format_options: format_options&.deep_symbolize_keys,
102
+ format_options: format_options&.to_h&.deep_symbolize_keys,
103
103
  file_name: file_name,
104
104
  allowed_columns: allowed_columns,
105
105
  required_columns: required_columns,
@@ -26,6 +26,7 @@ module RocketJob
26
26
  self.destroy_on_complete = false
27
27
  # Number of times to automatically retry the copy. Set to `0` for no retry attempts.
28
28
  self.retry_limit = 10
29
+ self.priority = 30
29
30
 
30
31
  # File names in IOStreams URL format.
31
32
  field :source_url, type: String, user_editable: true
@@ -59,7 +59,14 @@ module RocketJob
59
59
  if job.respond_to?(:upload)
60
60
  # Return the database connection for this thread back to the connection pool
61
61
  # in case the upload takes a long time and the database connection expires.
62
- ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)
62
+ if defined?(ActiveRecord::Base)
63
+ if ActiveRecord::Base.respond_to?(:connection_handler)
64
+ # Rails 7
65
+ ActiveRecord::Base.connection_handler.clear_active_connections!
66
+ else
67
+ ActiveRecord::Base.connection_pool.release_connection
68
+ end
69
+ end
63
70
 
64
71
  if original_file_name
65
72
  job.upload(upload_file_name, file_name: original_file_name)
@@ -58,3 +58,6 @@ module RocketJob
58
58
  @rails = true
59
59
  end
60
60
  end
61
+
62
+ # Slice is a reserved word in Rails 7, but already being used in RocketJob long before that.
63
+ Mongoid.destructive_fields.delete(:slice) if Mongoid.respond_to?(:destructive_fields)
@@ -105,7 +105,7 @@ module RocketJob
105
105
  def requeue_failed
106
106
  failed.update_all(
107
107
  "$unset" => {worker_name: nil, started_at: nil},
108
- "$set" => {state: :queued}
108
+ "$set" => {state: "queued"}
109
109
  )
110
110
  end
111
111
 
@@ -113,7 +113,7 @@ module RocketJob
113
113
  def requeue_running(worker_name)
114
114
  running.where(worker_name: /\A#{worker_name}/).update_all(
115
115
  "$unset" => {worker_name: nil, started_at: nil},
116
- "$set" => {state: :queued}
116
+ "$set" => {state: "queued"}
117
117
  )
118
118
  end
119
119
 
@@ -1,3 +1,3 @@
1
1
  module RocketJob
2
- VERSION = "6.2.0".freeze
2
+ VERSION = "6.3.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketjob
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 6.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-31 00:00:00.000000000 Z
11
+ date: 2023-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm