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 tap code to:

$channel.Supply.tap(->$val {
    react {
        whenever $conn.print("[$consumer] SENDING\r\n").Supply ->$result {
            given $result {
                when Kept {
                    whenever $conn.Supply ->$line {
                        print "[$consumer] $line";
                        if $line ~~ /^340/ {
                            whenever $conn.print("[$consumer]: value 
$val\r\n").Supply ->$r {
                                #note("[$consumer]: success") }
                        }else {
                            done;
                        }
                    }
                }
            }
        }
    }
}, done=>{say "[$consumer] DONE!";});


And it still hangs from time to time.


Best regards,
David Santiago

Reply via email to