standard-procedure-plumbing 0.4.2 → 0.4.3

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: 77cd887e8bdfc09198bcf94c65b6d52014383b6691625f41e7301b52ae223adf
4
- data.tar.gz: 4196496eff4bbc7b277592b22855dca3c29d87115130ca08a57796cb14436aae
3
+ metadata.gz: 95f2fc92882bb116a50fb4406b8d905b6783bfd0b2f74a4229162fd26a920668
4
+ data.tar.gz: a0db08496ca520d9ae6baf50495395b3f943869cc07105b8d5ef7cefc054f8bf
5
5
  SHA512:
6
- metadata.gz: 8e8614ed73bb33446e89294b7c94da3f39786a3c82704ac1c5187d5310edb5756db00bdfd38128743496b4af2bd1fdbde3027850a83406efdf76d5bd5fb3cf74
7
- data.tar.gz: f5b1d8f95e6a275817348a95b3761d0dcb991d2e504b87dbcf2a35f1b4a4ac0f96bc0a90a70f59113644034291dd9af83f30adcfb30965bc4c35ec3dc5996502
6
+ metadata.gz: 976815454b96a52880605f34fc7d7ae801259bedaa7807c148f9edc951e9e8766d35e9cc0988d2f572aa7076bf78e9b90a666468b1438b0b80abe6cb3e3d9947
7
+ data.tar.gz: 6c9852305cf8ac858d853cdeac89c57c3424838d5ee51a130a989210ffdd8337d393dd710f61d8cf0a3212f4027383840c7919e44d61c6c86e8bfb9af53eac8f
@@ -5,8 +5,8 @@ module Plumbing
5
5
  class Rails < Threaded
6
6
  protected
7
7
 
8
- def future(&)
9
- Concurrent::Promises.future do
8
+ def in_context(&)
9
+ super do
10
10
  Rails.application.executor.wrap(&)
11
11
  end
12
12
  end
@@ -18,10 +18,8 @@ module Plumbing
18
18
  # Send the message to the target and wrap the result
19
19
  def send_message(message_name, *args, **params, &block)
20
20
  Message.new(@target, message_name, Plumbing::Actor.transporter.marshal(*args, **params), block, Concurrent::MVar.new).tap do |message|
21
- @mutex.synchronize do
22
- @queue << message
23
- send_messages if @queue.any?
24
- end
21
+ @queue << message
22
+ send_messages
25
23
  end
26
24
  end
27
25
 
@@ -38,15 +36,18 @@ module Plumbing
38
36
 
39
37
  protected
40
38
 
41
- def future(&) = Concurrent::Promises.future(&)
39
+ def in_context(&)
40
+ Concurrent::Promises.future do
41
+ @mutex.synchronize(&)
42
+ end
43
+ end
42
44
 
43
45
  private
44
46
 
45
47
  def send_messages
46
- future do
47
- @mutex.synchronize do
48
- message = @queue.shift
49
- message&.call
48
+ in_context do
49
+ while (message = @queue.shift)
50
+ message.call
50
51
  end
51
52
  end
52
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plumbing
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard-procedure-plumbing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rahoul Baruah
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubygems_version: 3.5.17
99
+ rubygems_version: 3.5.12
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Plumbing - various pipelines for your ruby application