<nakilon>
that moment when you realise you just wanted to use a single concurrent pattern but it's already two of them and you need the third one...
<nakilon>
to obtain the data that isn't exposed in API I use chromium wrapped in semaphore(1) and now I'm thinking to use some pool of 5 browser instances
<nakilon>
how do I implement it with stdlib? I'm thinking about 5 loops that are somehow readd themselves to Queue
<nakilon>
or should they readd themselves to Enumerator?
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ruby
<nakilon>
hm, the enumerator block does not know when the instance is free
Sheilong has quit []
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ruby
perrierjouet has quit [Remote host closed the connection]
perrierjouet has joined #ruby
<nakilon>
with Queue I can now even get rid of Async::Semaphore; but now another weird thing happened: "Async::Task | ThreadError: Attempt to unlock a mutex which is not locked | Caused by Async::Stop: Async::Stop"
<nakilon>
I feel like Timeout and Async aren't friends
<nakilon>
maybe in ruby 3 I should use something different from Timeout::timeout.new?
<nakilon>
weird to call "Scheduler" object a "subtask" but I've seen it in some example
<ox1eef>
if it's IO i think you can use IO.select with a fourth arg as the duration of the timeout
<nakilon>
so I've replaced Timeout::timeout.new with subtask.with_timeout and it threw the "ThreadError: Attempt to unlock a mutex which is not locked" even faster lol
<ox1eef>
fun
<nakilon>
or actually maybe that's actually ok and I had to have this exception always but it was supressed/delayed and that was probably a reason of unpleasant progress behaviour of the program I described earlier; I should think what to do with failed tasks
<nakilon>
though the error message makes no sense to lib user who just faced a timeout
<nakilon>
I even see in docs: message = "execution expired" -- but it's never to be found in the error printed
<ox1eef>
still early days for async, if you find something to improve might be worth a GH issue
<nakilon>
hm, I've reduced the timelimit to cause the error and saw "Async::TimeoutError: execution expired" printed so that error above was for some another unknown reason, it's not my timeout
Thanzex7 has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
<nakilon>
looks like when you define a task that immediately fails and you do .wait it quickly prints the exception but the return from .wait takes almost a second
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<nakilon>
or even to two seconds; I rescue the .wait to print the task.status (it is :failed) and reraise to stop the program (because it does not stop on its own if it's StandardError)
<nakilon>
finally after this https://dpaste.org/ZLfW/slim it really fails now and prints the real reason; and before it hangs )
<nakilon>
now I see not only "ThreadError: Attempt to unlock a mutex which is not locked" followed by "Caused by Async::Stop: Async::Stop" but also "some async task failed (Exception)", "Attempt to unlock a mutex which is not locked (ThreadError)", "execution expired (Async::TimeoutError)"
<nakilon>
for some reason my (4th) error was not printed and it confused me; though it's weird that if I throw Timeout a bit earlier (like when I tested setting very low Timeout.new arg value) it was printed
e2 has quit [Quit: Stable ZNC provider #bnc4you]
<nakilon>
ok, async docs don't open anymore; I need adam12 )
cdown has quit [Remote host closed the connection]
cdown has joined #ruby
<nakilon>
subtask.with_timeout accepts the error message arg only in async -v 2.0.0 that is only for ruby 3.1 but in rbenv there is only 3.0.2 and 3.1.0-dev _<>
e2 has joined #ruby
fef has joined #ruby
jlindgren has quit [Remote host closed the connection]
nakilon has left #ruby [rasengan did nothing wrong]
nakilon has joined #ruby
<nakilon>
oops, pressed something
<nakilon>
the error chain is still changing time to time; now I see my timeout line in backtrace but not my error message -- instead it is "Attempt to unlock a mutex which is not locked", "attempt to resume the current fiber (FiberError)"
nullheroes2 has quit [Quit: WeeChat 2.3]
ur5us has quit [Ping timeout: 240 seconds]
constxd_ has quit [Ping timeout: 256 seconds]
bluedust has joined #ruby
fef has quit [Ping timeout: 276 seconds]
oxfuxxx has joined #ruby
<nakilon>
google knows nothing about "attempt to resume the current fiber"; I would report it if I could localize it; the backtrace is short: https://dpaste.org/X02b/slim
bluedust_ has joined #ruby
bluedust has quit [Remote host closed the connection]
bluedust has joined #ruby
bluedust_ has quit [Ping timeout: 256 seconds]
<nakilon>
changed Timeout::timeout to subtask.with_timeout and error is gone
<nakilon>
(the 2 seconds large lag I said about earlier -- that's maybe because thousands of tasks starting together eat too much ram or disk read)
oxfuxxx has quit [Quit: can you please adjust your IRC quit message to be less transphobic?]
Duneyrr has joined #ruby
_ht has joined #ruby
Thanzex has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
bluedust has quit [Read error: Connection reset by peer]