This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
rcmlz Hello, how can I use throttle() to limit the call to lets say 1 per second? I somehow can not make it work. Thank you. 18:24
m: my atomicint $lock = 0; react { whenever watch-recursive($dir).throttle(1) { if cas($lock, 0, 1) { $runner.run; cas($lock, 1, 0); } } }
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Variable '$dir' is not declared. Did you mean '&dir'? at /home/glot/main.raku:3 ------> whenever watch-recursive(⏏$dir).throttle(1) {
rcmlz It works like this but I suspect that there will be many events emited by watch-recursive() (from IO::Notification::Recursive). I also fail to get it working using the build in watch-path(). 18:28
ab5tract rcmlz: are you trying to have `$runner.run` call once every second? or you only want to process one event per second? 18:51