Skip to content

Commit aeba0de

Browse files
committed
Tidy up environment variable usage.
1 parent a2b56e9 commit aeba0de

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

.github/workflows/test-coverage.yaml

+14-16
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,35 @@ jobs:
1919
include:
2020
- os: ubuntu
2121
ruby: "3.1"
22-
selector: EPoll
22+
io_event_selector: EPoll
2323
- os: ubuntu
2424
ruby: "3.2"
25-
selector: EPoll
25+
io_event_selector: EPoll
2626
- os: ubuntu
2727
ruby: "3.3"
28-
selector: EPoll
28+
io_event_selector: EPoll
2929
- os: ubuntu
3030
ruby: "3.4"
31-
selector: EPoll
31+
io_event_selector: EPoll
3232
- os: ubuntu
3333
ruby: "3.4"
34-
selector: URing
34+
io_event_selector: URing
3535
- os: ubuntu
3636
ruby: "3.4"
37-
selector: URing
38-
fiber_profile_capture: "true"
37+
io_event_selector: URing
38+
fiber_profiler_capture: "true"
3939
- os: ubuntu
4040
ruby: "head"
41-
selector: URing
41+
io_event_selector: URing
4242
- os: ubuntu
4343
ruby: "head"
44-
selector: URing
45-
worker_pool: "true"
44+
io_event_selector: URing
45+
async_scheduler_worker_pool: "true"
4646

4747
env:
48-
FIBER_PROFILER_CAPTURE: ${{matrix.fiber_profile_capture}}
48+
IO_EVENT_SELECTOR: ${{matrix.io_event_selector}}
49+
ASYNC_SCHEDULER_WORKER_POOL: ${{matrix.async_scheduler_worker_pool}}
50+
FIBER_PROFILER_CAPTURE: ${{matrix.fiber_profiler_capture}}
4951

5052
steps:
5153
- uses: actions/checkout@v4
@@ -58,17 +60,13 @@ jobs:
5860

5961
- name: Run tests
6062
timeout-minutes: 5
61-
env:
62-
IO_EVENT_SELECTOR: ${{matrix.selector}}
63-
ASYNC_SCHEDULER_DEFAULT_WORKER_POOL: ${{matrix.worker_pool}}
64-
FIBER_PROFILER_CAPTURE: ${{matrix.fiber_profile_capture}}
6563
run: bundle exec bake test
6664

6765
- uses: actions/upload-artifact@v4
6866
with:
6967
include-hidden-files: true
7068
if-no-files-found: error
71-
name: coverage-${{matrix.os}}-${{matrix.ruby}}-${{matrix.selector}}-${{matrix.worker_pool}}-${{matrix.fiber_profile_capture}}
69+
name: coverage-${{matrix.os}}-${{matrix.ruby}}-${{matrix.io_event_selector}}-${{matrix.async_scheduler_worker_pool}}-${{matrix.fiber_profiler_capture}}
7270
path: .covered.db
7371

7472
validate:

.github/workflows/test-worker-pool.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ permissions:
77

88
env:
99
CONSOLE_OUTPUT: XTerm
10-
ASYNC_SCHEDULER_DEFAULT_WORKER_POOL: true
10+
ASYNC_SCHEDULER_WORKER_POOL: true
1111

1212
jobs:
1313
test:
14-
name: ${{matrix.ruby}} on ${{matrix.os}} / ASYNC_SCHEDULER_DEFAULT_WORKER_POOL=true
14+
name: ${{matrix.ruby}} on ${{matrix.os}} / ASYNC_SCHEDULER_WORKER_POOL=true
1515
runs-on: ${{matrix.os}}-latest
1616

1717
strategy:

lib/async/scheduler.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module Async
2525

2626
# Handles scheduling of fibers. Implements the fiber scheduler interface.
2727
class Scheduler < Node
28-
DEFAULT_WORKER_POOL = ENV.fetch("ASYNC_SCHEDULER_DEFAULT_WORKER_POOL", nil).then do |value|
28+
WORKER_POOL = ENV.fetch("ASYNC_SCHEDULER_WORKER_POOL", nil).then do |value|
2929
value == "true" ? true : nil
3030
end
3131

@@ -50,7 +50,7 @@ def self.supported?
5050
# @public Since *Async v1*.
5151
# @parameter parent [Node | Nil] The parent node to use for task hierarchy.
5252
# @parameter selector [IO::Event::Selector] The selector to use for event handling.
53-
def initialize(parent = nil, selector: nil, profiler: Profiler&.default, worker_pool: DEFAULT_WORKER_POOL)
53+
def initialize(parent = nil, selector: nil, profiler: Profiler&.default, worker_pool: WORKER_POOL)
5454
super(parent)
5555

5656
@selector = selector || ::IO::Event::Selector.new(Fiber.current)

releases.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Rename `ASYNC_SCHEDULER_DEFAULT_WORKER_POOL` to `ASYNC_SCHEDULER_WORKER_POOL`.
6+
57
### Fiber Stall Profiler
68

79
After several iterations of experimentation, we are officially introducing the fiber stall profiler, implemented using the optional `fiber-profiler` gem. This gem is not included by default, but can be added to your project:
@@ -30,7 +32,7 @@ Ruby 3.4 will feature a new fiber scheduler hook, `blocking_operation_wait` whic
3032

3133
The Async scheduler optionally supports this feature using a worker pool, by using the following environment variable:
3234

33-
ASYNC_SCHEDULER_DEFAULT_WORKER_POOL=true
35+
ASYNC_SCHEDULER_WORKER_POOL=true
3436

3537
This will cause the scheduler to use a worker pool for general blocking operations, rather than blocking the event loop.
3638

0 commit comments

Comments
 (0)