async-container 0.27.5 → 0.27.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b33373c25e8c39d091f9f9013eb12579d08f01c03ec14612767b607041d59688
4
- data.tar.gz: 2990fa6ab90beb2a67b9bf4ef47c8b8c58590426df73652642d771544c9d15dd
3
+ metadata.gz: e24f5190b56ac438bc6944606f03b532842f4941ddce2aafdd4da22e84ebb2d2
4
+ data.tar.gz: 7808c2b84c7588a98ff110a3d9409a3daba3dc91d5effe97e6b5e8d6be14a85c
5
5
  SHA512:
6
- metadata.gz: 30a81d6c5eede1bf527b9f4493efcd41f2080db091eacb96cfa841cda6c044d52d45bb714dda55009c26bfc1834b18219ff1552116852dc0a7daa7c5a8d34d87
7
- data.tar.gz: be8f6b931ed89cbef3ae8cf04c73519b3184d47ead5a0d3cbe84fb8b99fb178eb031c482b25b2380936450ae97134b0e2c8362d10b6c293e979b8c356cf32b20
6
+ metadata.gz: bbcefc876ceea7648bda5543ff6fbfa5756fa19808e7cc725c3a7e3e97be63c3f591227861c8f0aa067ff2559a4f097c951a042b2d30e279300b22a9ced1e2fd
7
+ data.tar.gz: 04de5a914ebcd62fc58c11daa52bcf35342bd336bee0ac83a2b1f7d2c51c0c2631c08330de70c3ece2d250c37beb6e5f516a6e8b5088f903f160352711bcbc55
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2025, by Samuel Williams.
5
5
 
6
6
  require "json"
7
7
 
@@ -10,8 +10,9 @@ module Async
10
10
  # Provides a basic multi-thread/multi-process uni-directional communication channel.
11
11
  class Channel
12
12
  # Initialize the channel using a pipe.
13
- def initialize
13
+ def initialize(timeout: 1.0)
14
14
  @in, @out = ::IO.pipe
15
+ @in.timeout = timeout
15
16
  end
16
17
 
17
18
  # The input end of the pipe.
@@ -43,12 +44,11 @@ module Async
43
44
  # @returns [Hash]
44
45
  def receive
45
46
  if data = @in.gets
46
- begin
47
- return JSON.parse(data, symbolize_names: true)
48
- rescue
49
- return {line: data}
50
- end
47
+ return JSON.parse(data, symbolize_names: true)
51
48
  end
49
+ rescue => error
50
+ Console.error(self, "Error during channel receive!", error)
51
+ return nil
52
52
  end
53
53
  end
54
54
  end
@@ -136,8 +136,8 @@ module Async
136
136
 
137
137
  # Initialize the process.
138
138
  # @parameter name [String] The name to use for the child process.
139
- def initialize(name: nil)
140
- super()
139
+ def initialize(name: nil, **options)
140
+ super(**options)
141
141
 
142
142
  @name = name
143
143
  @status = nil
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2019-2025, by Samuel Williams.
5
+ # Copyright, 2025, by Marc-André Cournoyer.
5
6
 
6
7
  require "etc"
7
8
  require "async/clock"
@@ -63,9 +63,9 @@ module Async
63
63
  # Formats the message using JSON and sends it to the parent controller.
64
64
  # This is suitable for use with {Channel}.
65
65
  def send(**message)
66
- data = ::JSON.dump(message)
66
+ data = ::JSON.dump(message) << "\n"
67
67
 
68
- @io.puts(data)
68
+ @io.write(data)
69
69
  @io.flush
70
70
  end
71
71
 
@@ -124,8 +124,8 @@ module Async
124
124
  # Initialize the thread.
125
125
  #
126
126
  # @parameter name [String] The name to use for the child thread.
127
- def initialize(name: nil)
128
- super()
127
+ def initialize(name: nil, **options)
128
+ super(**options)
129
129
 
130
130
  @status = nil
131
131
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Container
8
- VERSION = "0.27.5"
8
+ VERSION = "0.27.6"
9
9
  end
10
10
  end
data/license.md CHANGED
@@ -5,6 +5,7 @@ Copyright, 2019, by Yuji Yaginuma.
5
5
  Copyright, 2020, by Olle Jonsson.
6
6
  Copyright, 2020, by Juan Antonio Martín Lucas.
7
7
  Copyright, 2022, by Anton Sozontov.
8
+ Copyright, 2025, by Marc-André Cournoyer.
8
9
 
9
10
  Permission is hereby granted, free of charge, to any person obtaining a copy
10
11
  of this software and associated documentation files (the "Software"), to deal
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.5
4
+ version: 0.27.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Olle Jonsson
9
9
  - Anton Sozontov
10
10
  - Juan Antonio Martín Lucas
11
+ - Marc-André Cournoyer
11
12
  - Yuji Yaginuma
12
13
  bindir: bin
13
14
  cert_chain:
metadata.gz.sig CHANGED
Binary file