⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (624 Bytes)
Bug #19853
» fiber_bug.rb
Script to replicate this problem -
rmosolgo (Robert Mosolgo)
, 08/28/2023 04:05 PM
require
"bundler/inline"
gemfile
do
gem
"graphql"
,
github:
"rmosolgo/graphql-ruby"
,
ref:
"fiber_scheduler-compat"
gem
"async"
end
class
MySchema
<
GraphQL
::
Schema
class
Query
<
GraphQL
::
Schema
::
Object
field
:value
,
Float
def
value
duration
=
[
0.1
,
0.3
,
0.5
].
sample
system
(
"sleep
#{
duration
}
"
)
duration
end
end
query
(
Query
)
use
GraphQL
::
Dataloader
,
nonblocking:
true
,
fiber_control_mode: :transfer
end
start
=
Time
.
now
puts
"Starting..."
Fiber
.
set_scheduler
(
Async
::
Scheduler
.
new
)
pp
MySchema
.
execute
(
"{ v1: value v2: value }"
).
to_h
puts
"Ended"
pp
[
:duration
,
Time
.
now
-
start
]
« Previous
1
2
Next »
(2-2/2)
Loading...