The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2016-11-27

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:21 jberger can someone please say anything? there has literally been no traffic since I restarted convos and its freaking me out ;-P
00:22 Grinnz beep boop
00:22 mishanti1 bork bork
00:22 jberger thanks :D
00:22 mishanti1 np
00:23 sri :S
00:23 jberger yet more reasons to love this community, I got a beep boop and a bork bork as the first things people thought of
00:23 mishanti1 I'm just sitting here staring at some test files. Trying to figure out how I can have my tests wait for an event to be emitted from my $app.
00:24 jberger subscribe to the event and as the last thing in the callback add Mojo::IOLoop->stop
00:24 jberger then call Mojo::IOLoop->start
00:24 jberger (outside of the callback obviously)
00:25 Grinnz and you always want a timeout to also stop the loop
00:25 jberger yes, that's a good idea too
00:32 mishanti1 But, when calling $ioloop->stop, does not that make the $app not have a working ioloop so subsequent requests are not processed (eg. tests further down in the test file)?
00:32 Grinnz ioloop tests are a series of setup your watchers/timers, start the ioloop, wait for it to stop, test things
00:32 Grinnz repeat
00:32 jberger the tests don't have a running loop unless you started it
00:33 mishanti1 Right, ok. So I need to restructure my tests quite a bit. But that's fine.
00:33 jberger :-P
00:34 jberger remember for example that Mojolicious applications can run under plack and even cgi
00:34 jberger where there is no ioloop available
00:34 Grinnz note that Test::Mojo methods like ->get_ok will be running the loop themselves for your app
00:34 jberger the only things that start the loop are the daemon/morbo/prefork/hypnotoad scripts
00:35 mishanti1 Grinnz: Are you sure? If I at any point have run ->stop then all subseqent calls to ->get_ok() are bothced.
00:35 mishanti1 *botched
00:35 Grinnz no
00:35 Grinnz the loop must stop for any of your subsequent code to even run
00:36 Grinnz reading https://metacpan.org/source/SRI/Mojolicious-7.10/lib/Test/Mojo.pm#L351 might be helpful
00:36 mishanti1 Grinnz: Yeah, when I call ->stop from inside the callback the tests proceed. However all get_ok() calls fail, and I am assuming that is because the app no longer has a running loop.
00:37 mishanti1 Grinnz: Currently reading it :)
00:38 Grinnz https://metacpan.org/source/SRI/Mojolicious-7.10/lib/Test/Mojo.pm#L376 is actually what will run the loop (for non-websocket requests)
00:38 Grinnz ->start with no callback will run the useragent's internal ioloop
00:39 Grinnz but note that's a different ioloop from the singleton
00:40 Grinnz actually nevermind, it does set it to the singleton
00:40 Grinnz https://metacpan.org/source/SRI/Mojolicious-7.10/lib/Test/Mojo.pm#L20
00:40 Grinnz which makes sense, otherwise your app's loop wouldn't be run
00:41 Grinnz but yeah if you manually stop taht, the useragent's request might not complete
00:41 Grinnz not sure what would happen
00:51 mishanti1 So I guess what I am struggling to understand is how I could ever get ->get_ok() to run if the ioloop has to be started for it to work, but starting the ioloop makes execution "hang" on the line on which ->start was called making control never reach the ->get_ok().
00:52 mishanti1 And sorry if I'm being really daft here. Trying to understart the various components, and have clearly quite a ways to go yet.
00:52 Grinnz well you have to make it so it doesn't hang, if you can't just stop the ioloop then remove the timers and whatever you added
00:53 Grinnz and if you do reach the timeouts which stop the loop, thats geenrally a test failure anyway
01:18 aborazmeh joined #mojo
01:35 mishanti1 jberger, Grinnz : Thank you both for your patience and help. It is now working perfectly, thanks to you guys.
01:38 Grinnz cool. also, thinking about it more, if you do just stop the loop in the middle of a ->get_ok, you could also just call ->reset on the ioloop to get rid of any pending transactions
01:39 Grinnz though that could just screw it up more, so i still dont like it as much as just removing what you added
01:43 mishanti1 I will experiement some more tomorrow I think and see if there are more elegant ways of doing it that what I have currently. If I don't find any I am perfectly happy leaving it like it is now. Works quite well.
02:35 jberger mishanti1++
03:26 noganex joined #mojo
05:04 dboehmer joined #mojo
05:30 aborazmeh joined #mojo
06:09 polettix joined #mojo
08:05 ivi joined #mojo
08:18 dod joined #mojo
08:25 dod joined #mojo
08:29 batman joined #mojo
08:42 Grinnz no need to keep the specific IP address bans since he's reset his modem a bunch of times...
08:59 dod joined #mojo
09:35 ivi joined #mojo
09:41 rshadow joined #mojo
11:19 batman joined #mojo
11:40 dod joined #mojo
12:02 Paddi joined #mojo
12:18 abra joined #mojo
14:17 CandyAngel /query jberger
14:17 CandyAngel And that is why I don't like Python
14:17 CandyAngel Whitespaaaaaaaace *shakes fist" :P
14:22 jberger gotta be careful about leading whitespace
14:22 CandyAngel Sorry for the accidental highlight
14:22 jberger s'ok
15:09 dod joined #mojo
15:28 asarch joined #mojo
15:48 disputin joined #mojo
16:01 disputin joined #mojo
16:38 dod joined #mojo
17:00 lluad joined #mojo
17:11 PryMar56 joined #mojo
18:23 jberger joined #mojo
18:48 dave joined #mojo
19:12 rshadow joined #mojo
19:37 dod joined #mojo
19:46 sugar joined #mojo
20:16 sugar joined #mojo
22:49 sugar joined #mojo
23:41 zivester joined #mojo
23:45 sugar joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary