-
-
Notifications
You must be signed in to change notification settings - Fork 103
Closed
Description
I don't seem to have scope for my ActiveRecord model inside an Async::Task.
For my model named F I get:
NameError: uninitialized constant F
My implementation:
Async do
# Queue of up to 10 items:
items = Async::LimitedQueue.new(10)
# Five producers:
5.times do
Async do |task|
# while true
while F.unchecked.count.positive?
# t = rand
f = F.unchecked.first
f.do_checking!
t = check_f(f)
task.sleep(t)
items.enqueue(t)
end
end
end
# A single consumer:
Async do |task|
while item = items.dequeue
puts "dequeue -> #{item}"
end
end
endI also tried using ::F but got the same error.
Metadata
Metadata
Assignees
Labels
No labels