Re: Nested `whenever` (was Re: Help with bug)

2021-01-05 Thread Gianni Ceccarelli
On 2021-01-05 David Emanuel da Costa Santiago wrote: > > so the inner ``whenever`` really sets up a separate tap every time > > it's executed. > Is this behaviour expected? It kinda looks weird to me, specially > when looking to the output... Well, it's what *I* expected: a ``whenever`` sets

Re: Nested `whenever` (was Re: Help with bug)

2021-01-05 Thread David Emanuel da Costa Santiago
Às 13:25 de 05/01/21, Gianni Ceccarelli escreveu: > >received outer 0 >received outer 1 >received outer 2 >received outer 3 >received inner 0 for outer 0 >received inner 0 for outer 1 >received inner 0 for outer 2 >received inner 0 for outer 3 >received inner

Nested `whenever` (was Re: Help with bug)

2021-01-05 Thread Gianni Ceccarelli
On 2020-12-30 Gianni Ceccarelli wrote: > Also, my understanding of ``whenever`` is that it's adding a hook into > the event loop, and only leaving the surrounding ``react`` (or > ``supply``) will remove that hook (people who understand this better > than I do: please correct me!). If that's true,

Re: Help with bug

2020-12-30 Thread David Santiago
Thanks for the explanation! A December 30, 2020 3:28:24 PM UTC, Gianni Ceccarelli escreveu: >On 2020-12-30 David Santiago wrote: >> Thanks! It's indeed much clearer. However i have a question, why the >> react on line 24? >> >> The react there isn't required right? > >I think it is ☺ The code

Re: Help with bug

2020-12-30 Thread Gianni Ceccarelli
On 2020-12-30 David Santiago wrote: > Thanks! It's indeed much clearer. However i have a question, why the > react on line 24? > > The react there isn't required right? I think it is ☺ The code, without the debugging bits:: react { whenever $channel -> $val { $conn.prin

Re: Help with bug

2020-12-30 Thread David Santiago
Às 14:43 de 30/12/20, Gianni Ceccarelli escreveu: David: please look at my version of your code, I really think it's clearer and simpler to work with, without the explicit ``.tap`` and ``.then`` (ok, I have a few ``.then``, but they're for debugging, they don't affect the actual working of the

Re: Help with bug

2020-12-30 Thread Elizabeth Mattijsen
Thank you for the compliment. But I was merely channeling Jonathan Worthington... :-) > On 30 Dec 2020, at 14:43, Gianni Ceccarelli wrote: > > Liz is, as usual, correct: there's no reason to wait until our write > buffers are flushed (``await $conn.print``) before ``react``ing to > what's in

Re: Help with bug

2020-12-30 Thread Gianni Ceccarelli
Liz is, as usual, correct: there's no reason to wait until our write buffers are flushed (``await $conn.print``) before ``react``ing to what's in our *read* buffers. In https://github.com/dakkar/raku-socket-test-from-demanuel I've removed all ``await`` but one (the ``await .connect``), and the pro

Re: Help with bug

2020-12-30 Thread David Santiago
Hi! Às 00:16 de 30/12/20, Elizabeth Mattijsen escreveu: react, feels like a code smell to me. An `await` will block the `react` block from processing other messages until the `await` returns. Which feels like it is opening up a large window of dead-locking opportunities. I changed the t

Re: Help with bug

2020-12-29 Thread Tom Browder
On Tue, Dec 29, 2020 at 17:16 Elizabeth Mattijsen wrote: > Using an `await` inside a react, feels like a code smell to me. An > `await` will I suggest using 'note' for debugging instead of print or say so info is not delayed and goes straight to stderr. -Tom

Re: Help with bug

2020-12-29 Thread Elizabeth Mattijsen
Using an `await` inside a react, feels like a code smell to me. An `await` will block the `react` block from processing other messages until the `await` returns. Which feels like it is opening up a large window of dead-locking opportunities. Couldn't a whenever be used there instead? > On 29

Re: Help with bug

2020-12-29 Thread David Santiago
Às 19:12 de 29/12/20, Gianni Ceccarelli escreveu: I fear we've uncovered a hard-to-diagnose bug in ``IO::Socket::Async::SSL`` … :-( Thanks for the confirmation. Hopefully this can be used as a test case to help solve it. Best regards, David Santiago

Re: Help with bug

2020-12-29 Thread Gianni Ceccarelli
On 2020-12-29 David Santiago wrote: > i don't want it to exit, i want it to keep reading from the socket > until a "200" code happens. Sorry, I had mis-understood the protocol. I've put the code on Github so it's easier to look at it https://github.com/dakkar/raku-socket-test-from-demanuel (thos

Re: Help with bug

2020-12-29 Thread David Santiago
Hi! Gianni Ceccarelli wrote: if $line ~~ /^340/ { await $conn.print("[$consumer]: value $val\r\n"); } else { done; } Notice that if the client receives a 340, it sends stuff back to the server, and *does not exit*. You may want to add a ``done`` after that `

Re: Help with bug

2020-12-29 Thread Gianni Ceccarelli
On 2020-12-29 David Santiago wrote: > I need some help in debugging my script. Sometimes it hangs and i > don't know why. I'm pretty sure it hangs in the inner ``react``:: if $line ~~ /^340/ { await $conn.print("[$consumer]: value $val\r\n"); } else { done; } Notice

Re: Help with bug

2020-12-29 Thread ToddAndMargo via perl6-users
On 12/29/20 4:37 AM, David Santiago wrote: Hi! I need some help in debugging my script. Sometimes it hangs and i don't know why. Hi David, I do not know if it will help you, but in my longer programs I have found that "say" will print out the prior valuies of things and generally drove me n

Help with bug

2020-12-29 Thread David Santiago
Hi! I need some help in debugging my script. Sometimes it hangs and i don't know why. There's a channel with all the values, and then i create N promises to take a value from the channel and to write it to a socket. (one producer with multiple consumers) I'm attaching two scripts (client