Skip to content

Commit 46c36c3

Browse files
committed
Limit Ractor support to 3.4+.
1 parent 0f03c4b commit 46c36c3

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

lib/console/filter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Console
1111

1212
# A log filter which can be used to filter log messages based on severity, subject, and other criteria.
1313
class Filter
14-
if Object.const_defined?(:Ractor) and RUBY_VERSION >= "3.1"
14+
if Object.const_defined?(:Ractor) and RUBY_VERSION >= "3.4"
1515
# Define a method which can be shared between ractors.
1616
def self.define_immutable_method(name, &block)
1717
block = Ractor.make_shareable(block)

releases.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Add `fid` (Fiber ID) to serialized output records to help identify which fiber logged the message.
6+
- Ractor support appears broken in older Ruby versions, so we now require Ruby 3.4 or later for Ractor compatibility, if you need Ractor support.
67

78
## v1.31.0
89

test/console/ractor.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
return unless defined?(Ractor)
99

10+
# Ractors are more or less broken in older Ruby versions, so we require Ruby 3.4 or later for Ractor compatibility.
11+
return unless RUBY_VERSION >= "3.4"
12+
1013
describe Console do
1114
with Ractor do
1215
it "can log messages from within a ractor" do
@@ -49,13 +52,13 @@
4952

5053
{
5154
result: "Ractor #{id} completed",
52-
messages: capture.records.map {|record| record[:subject]}
55+
messages: capture.records.map{|record| record[:subject]}
5356
}
5457
end
5558
end
5659

5760
outputs = ractors.map(&:take)
58-
results = outputs.map {|output| output[:result]}
61+
results = outputs.map{|output| output[:result]}
5962

6063
expect(results).to be == [
6164
"Ractor 0 completed",
@@ -82,7 +85,7 @@
8285
logger.warn("Captured warning")
8386

8487
# Return the captured messages
85-
capture.records.map {|record| record[:subject]}
88+
capture.records.map{|record| record[:subject]}
8689
end
8790

8891
captured_messages = ractor.take

0 commit comments

Comments
 (0)