create_update_destroy_async 0.1.0 → 0.1.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: 2bab654a7b0e40f7cff90fcd7d988f9d56c9b2368f2a40cd7eed358746dce7a0
4
- data.tar.gz: 96f07c4dc56362f8fd9214a0674315cd9794588d63534ec85ad5f1be20dc6e24
3
+ metadata.gz: dc60e170fe0bbe213a2c14f8d983017a3144986c575d9fc131b6dc05df7621bd
4
+ data.tar.gz: 210ec02b468c4f2b12b2ea5de99824b8e21bbe4a361a62ee3bb1d3979db583e8
5
5
  SHA512:
6
- metadata.gz: efe9bfc96f4b39171484e19b678f79652837ba56a0ca08b0defe60bc2fce14fc8a1c7daa22cf55b082912037331e4fbf873dd869a5fa7b448ed151a8ea181e49
7
- data.tar.gz: 6bf428544ebb7f0e0d760ded274450fc56409fd83b2c4a0adde210b425882495833a4ec139a40656f3c24336851d3543d4f4b477b5930765ef8ff1af697476a4
6
+ metadata.gz: 84d533ce63ed7efb278ea76231c83ca550a944ea8c1dc8b3a3d8b1c55aaa0dd177451cb9ca37be6f2e54d520e89b3f89e563c234eb860b0067837a4de62c26a1
7
+ data.tar.gz: e026ed5fa78ee35dad0e8ce05bc822380827a6ba2cb5186dfa74e918afae07634d1ba0f8e6c0d7cf7add824ea98783c9300c4e73b874f7e1e456d4a52d1592bb
data/README.md CHANGED
@@ -127,6 +127,12 @@ $ bundle
127
127
  - `wrk -c100 http://127.0.0.1:3000/home/index2`
128
128
  - repeat few times to be 100% sure
129
129
 
130
+ ## Development
131
+
132
+ You can start rails s in dummy app, and open http://localhost:3000/home/index1 and http://localhost:3000/home/index2.
133
+
134
+ In addition you need to start Sidekiq in the background.
135
+
130
136
  ## Contributing
131
137
 
132
138
  You are welcome to contribute.
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CreateUpdateDestroyAsync
4
+ module Jobs
5
+ class Base < ActiveJob::Base
6
+ queue_as { ActiveRecord.queues[:create_update_destroy_async_queue] }
7
+
8
+ discard_on ActiveJob::DeserializationError
9
+ end
10
+ end
11
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CreateUpdateDestroyAsync
4
4
  module Jobs
5
- class Create < ActiveJob::Base
5
+ class Create < Base
6
6
  def perform(klass, attributes = {})
7
7
  model = klass.constantize
8
8
  model.create(attributes)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CreateUpdateDestroyAsync
4
4
  module Jobs
5
- class Destroy < ActiveJob::Base
5
+ class Destroy < Base
6
6
  def perform(record)
7
7
  record.destroy
8
8
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CreateUpdateDestroyAsync
4
4
  module Jobs
5
- class Save < ActiveJob::Base
5
+ class Save < Base
6
6
  def perform(record, attributes = {})
7
7
  record.assign_attributes(attributes)
8
8
  record.save
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CreateUpdateDestroyAsync
4
4
  module Jobs
5
- class Update < ActiveJob::Base
5
+ class Update < Base
6
6
  def perform(record, attributes = {})
7
7
  record.update(attributes)
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module CreateUpdateDestroyAsync
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "create_update_destroy_async/version"
2
+ require "create_update_destroy_async/jobs/base"
2
3
  require "create_update_destroy_async/jobs/create"
3
4
  require "create_update_destroy_async/jobs/save"
4
5
  require "create_update_destroy_async/jobs/update"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: create_update_destroy_async
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-11 00:00:00.000000000 Z
12
+ date: 2023-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -81,6 +81,7 @@ files:
81
81
  - Rakefile
82
82
  - lib/create_update_destroy_async.rb
83
83
  - lib/create_update_destroy_async/active_record_ext.rb
84
+ - lib/create_update_destroy_async/jobs/base.rb
84
85
  - lib/create_update_destroy_async/jobs/create.rb
85
86
  - lib/create_update_destroy_async/jobs/destroy.rb
86
87
  - lib/create_update_destroy_async/jobs/save.rb
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  - !ruby/object:Gem::Version
108
109
  version: '0'
109
110
  requirements: []
110
- rubygems_version: 3.3.7
111
+ rubygems_version: 3.4.10
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: Execute create/update/destroy operations asynchronously in your Rails app