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

IRC log for #mojo, 2016-02-12

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

All times shown according to UTC.

Time Nick Message
01:18 bradjm joined #mojo
01:39 bradjm joined #mojo
03:07 oalders i'm using toadfarm to stop/start an app.  is there an equivalent way of easily setting up an init script to stop/start minion workers?
03:07 sri not yet
03:09 oalders ok, so is using something like Daemon::Control a reasonable way to do it?
03:09 sri ye
03:09 noganex_ joined #mojo
03:09 sri minion workers are way easier to manage than hypnotoad
03:10 sri it's just a plain old daemon, without anything fancy
03:10 oalders :) thanks. i'll start with Daemon::Control then
03:41 kivilahtio sri: I like the code hot reload with hypnotoad
03:41 kivilahtio oalders: .
03:58 mcsnolte joined #mojo
04:19 cpan_mojo Mojo-Pg-2.19 by SRI https://metacpan.org/release/SRI/Mojo-Pg-2.19
04:23 sri so, postgres experts
04:23 sri is there a clean way to turn this into one upsert? https://github.com/kraih/minion/blob/master/lib/Minion/Backend/Pg.pm#L85-L94
04:29 inokenty-w joined #mojo
04:38 cpan_mojo Mojo-Pg-2.20 by SRI https://metacpan.org/release/SRI/Mojo-Pg-2.20
05:54 vicash sri: while trying to get Mojoliocious-6.45 using cpanm I get "Problem uploading file 't/mojolicious/commands.t': Connect timeout". I have installed IO::Socket::SSL latest as well but no idea why that fails.
06:12 rsindlin joined #mojo
06:17 rsindlin joined #mojo
06:39 good_news_everyon joined #mojo
06:39 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgP7G
06:39 good_news_everyon mojo/master c33f844 Sebastian Riedel: make sure a proxy server is actually used
06:39 good_news_everyon left #mojo
07:26 dod joined #mojo
07:28 sugar joined #mojo
07:32 dod joined #mojo
07:47 melo joined #mojo
07:47 avkhozov joined #mojo
07:54 bjakubski joined #mojo
07:55 osfabibisi joined #mojo
08:12 Vandal joined #mojo
08:17 AndrewIsh joined #mojo
08:20 trone joined #mojo
08:21 avkhozov joined #mojo
08:25 avkhozov joined #mojo
08:32 berov joined #mojo
08:33 avkhozov joined #mojo
08:40 bowtie_ joined #mojo
10:05 circ-user-KouNY joined #mojo
10:16 ribasushi preaction: taking back my comment re darwin smokers earlier - it appears Stanislaw Pusep is running one now
10:19 jontaylor joined #mojo
10:32 vinnix joined #mojo
10:32 cpan_mojo Swagger2-0.72 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Swagger2-0.72
10:37 creaktive joined #mojo
10:40 hernan604 speaking of Stanislaw Pusep ...
10:40 hernan604 10:16       ribasushi   preaction: taking back my comment re darwin smokers earlier - it appears Stanislaw Pusep is running one now
10:40 hernan604 preaction: needs darwin testing ?
10:41 creaktive oh hai, I am Stanislaw
10:56 ribasushi creaktive++ # afaik there were no regular Darwin smokes as recently as Oct last year
11:20 creaktive ribasushi: mine is more-or-less regular; I only smoke the updates of whitelisted modules :)
11:20 Averna joined #mojo
11:20 CHYC joined #mojo
11:33 melo joined #mojo
11:36 kaare joined #mojo
12:24 punter joined #mojo
13:02 asarch joined #mojo
13:03 mcsnolte joined #mojo
13:05 bowtie joined #mojo
13:45 neilhwatson joined #mojo
14:26 jontaylor joined #mojo
14:31 jontaylor_ joined #mojo
14:51 ramortegui joined #mojo
15:20 sri ribasushi: looks like nigel horne is also running a darwin smoker http://matrix.cpantesters.org/?dist=Mojolicious+6.45
15:40 ribasushi nod - situation has greatly improved since I last looked, hence "retracting"
15:42 orev joined #mojo
15:46 jberger I remember it being very hard to get OSX reports when I was working on Alien::Base too
15:46 jberger hopefully things are improving
15:51 sri what are default values here used for? https://github.com/kraih/mojo/issues/906
15:51 disputin joined #mojo
16:05 Ralesk when debugging a Mojo::UserAgent doing websocket, what should I be seeing in the Client >>> Server direction?
16:05 jberger Ralesk: you would only see the handshake
16:05 jberger use MOJO_WEBSOCKET_DEBUG=1 for seeing the websocket traffic
16:05 Ralesk ahh
16:25 gryphon joined #mojo
16:30 berov left #mojo
16:31 melo joined #mojo
16:31 disputin joined #mojo
16:35 melo joined #mojo
16:38 sri i guess defaults would be very easy to implement
16:46 preaction hernan604: cpantesters could use a wider variety / more osx testers, yes
16:47 sri so, google will just shut down spdy support in chrome in may
16:47 preaction in favor of http/2?
16:47 sri if that doesn't show their true intentions i don't know what would
16:48 sri spdy and http/2 were all about saving google ops money, not helping the web
16:49 sri because google itself has finished the move to http/2
16:49 sri anyone else barely started
16:51 sri if google truly cared about making the web faster they'd keep spdy around for a long time, because it is already deployed in the wild
16:54 sri oh well, fighting windmills... but stop saying google has altruistic intentions!
16:55 sri not sure why this bugs me so much... recently i've heard a few times how "google wants to make the workd better"
16:56 bradjm joined #mojo
16:56 sri *world
16:56 vicash they live in an echo chamber
16:56 sri no! they want you to watch more ads!
16:57 neilhwatson better for them.
16:58 jabberwok What's Good for GM^H^H Google is Good For America ™
16:58 jabberwok ^H^H^H^H The World
16:58 jberger the thing is, I'm sure they see it that wya
16:59 jberger they are altruistic in that once they dominate the world things will be better
16:59 vicash that attitude is pervasive in the silicon valley
16:59 neilhwatson That's what the Nazis said.
17:00 sri https://www.youtube.com/watch?v=Rkxg03z2PEo
17:01 dod joined #mojo
17:08 PryMar56 joined #mojo
17:09 romel joined #mojo
17:10 batman sri: do you see a case where default() makes sense..?
17:10 sri batman: nope
17:11 batman Me neither :/
17:11 batman I always provide defaults in input()...
17:12 sri it basically just turns "$validation->param('foo') // 'whatever'" into $validation->default('whatever')->param('foo')
17:12 batman $v->input->{foo} ||= 42;
17:12 sri sounds like he wants to bypass filters and checks for defaults (for some reason)
17:12 batman Not when the input is failing ::"/
17:13 batman Yeah. That doesn't make any sense to me :(
17:13 sri yea, your $validation->inpu->{foo} ||= 'whatever' doesn't work
17:14 sri at least for the described scenario
17:14 batman Huh? It works differently, but it works the way I want.
17:14 sri where the default value would show up even if validation for the user supplied value failed
17:14 batman Yeah. Right.
17:15 batman I don't get why you want an invalid default value :/
17:16 disputin joined #mojo
17:25 sri maybe there are good reasons for a default value, but the proposal so far is way too flawed
18:03 disputin joined #mojo
18:03 romel joined #mojo
18:15 bowtie joined #mojo
18:29 Vitrifur joined #mojo
18:31 melo joined #mojo
18:42 bowtie_ joined #mojo
18:56 * sri has started to include $minion->stats in benchmarks and sadly any new addition seems to reduce performance drastically
18:57 sri something as simple as "select count(*) from minion_jobs where delayed > now() and state = 'inactive'" turns 139/s into 99/s
19:01 dod joined #mojo
19:04 vicash select count(*) is always slow
19:06 Grinnz_ http://wiki.postgresql.org/wiki/Slow_Counting
19:07 Grinnz_ https://wiki.postgresql.org/wiki/Index-only_scans#Is_.22count.28.2A.29.22_much_faster_now.3F
19:07 Grinnz_ interesting reading
19:09 sri vicash: that seems to counter your claim
19:10 Grinnz_ it depends on whether the planner decided to do an index-only scan
19:11 sri it bugs me a little when people use terms like "always" so lax
19:11 * vicash goes into hiding
19:12 sri it's hard to optimize for an index only scan
19:14 sri perhaps you can't actually, since the query planner will likely use setup specific io stats
19:16 sri perhaps stats should be collected differently
19:42 vicash Grinnz_ that optimization is only for Pg 9.2 and above. in reality the way most developers write their select count(*) statements, it is slow.
19:43 vicash if you have many millions of rows in a single table, that itself is bad design.
19:44 vicash Pg offers inherited tables, and using check constraints you can create derived tables from parent tables to correctly optimize the scenarios. we do that for high volume time series databases at my firm... all in Pg 9.1
20:12 creaktive left #mojo
20:45 sri think i'll add TTIN and TTOU signal handling to the minion worker command
20:46 sri to increase and decrease to number of concurrent jobs
20:54 sri or maybe not
21:28 sri but Minion::Job gets a start event
21:29 sri emitted in the forked process before work begins, so $0 can be changed or args filtered, stuff logged, or whatever
21:30 sri then you get spawn from the parent, and start from the child
21:34 sri https://github.com/kraih/minion/commit/dfb3a8df7f3aef4404ff5f0955a26831f1a51d01
21:35 mspo doesn't it depend on the number of jobs?
21:36 FloydATC joined #mojo
21:36 FloydATC Good evening
21:37 sri o/
21:37 sri mspo: what do you mean?
21:37 mspo sri: ops/s
21:38 sri indeed
21:38 sri there's a lot of variables
21:38 sri number of jobs is something that can be tested though
21:38 sri while io performance is not
21:40 sri right now i'm benchmarking on an ssd, i imagine the query planner will behave completely different with an hdd
21:41 FloydATC On a particular URI I want an endless loop {select from sql, generate a tiny bit of text, sleep a bit}. So far I've only been able to make Mojo::IOLoop work through a sequence and then render, done
21:41 FloydATC is there any way to make it go back and repeat for an endless loop?
21:42 jberger FloydATC: generally I've used some form of "recursion" for that
21:42 jberger though in non-blocking it isn't actually recursion because the call stack doesn't grow
21:43 jberger my favorite example https://metacpan.org/source/JBERGER/Mojo-FriendFeed-0.05/lib/Mojo/FriendFeed.pm#L57
21:43 jberger though its for a service that is kaput
21:43 FloydATC *reading*
21:43 sri jberger: isn't that called tail recursion?
21:44 jberger not really
21:44 jberger queuing another nonblocking task before exiting the callback isn't really tail recursion
21:44 jberger because you still exit the scope
21:44 sri but you're queueing yourself
21:45 jberger its effectively the same thing
21:45 sri i think the term is "tail recursion"
21:45 jberger this is just semantics
21:45 jberger tail recursion is sub me { goto &deeper }
21:45 jberger well, sub me { goto &me }
21:46 jberger but note that you never hit that last }
21:47 jberger in this nonblocking analog you do exit the scope, its just that you queued yourself again before you exit
21:48 sri or is this trampolining?
21:49 jberger I don't know that term
21:49 marcus joined #mojo
21:49 * jberger looks
21:50 jberger yeah, that looks closer
21:52 jberger in typical recusion the stack depth grows, in tail recursion the stack depth stays at the same depth (say 1), in this (trampolining?) the stack depth actually gets decreases by one before "recursing" (1 -> 0 -> 1 ... )
21:54 FloydATC ...this code doesn't make any sense to me, sorry
21:55 jberger so that service was basically like twitter
21:55 jberger you could push messages to a published queue
21:55 jberger and others could watch it
21:55 jberger but it had this nice cursor form
21:56 Grinnz_ FloydATC: are you saying you want to do this in a request action?
21:56 jberger you'd request a queue and it would block until there was a new message or a timeout at which point it would respond to the request with the data you wanted and a new cursor
21:56 jberger you could then request the cursor and it would do the same thing again
21:57 jberger all I do there is when I request the cursor url I give __SUB__ as the callback
21:57 jberger so it's explicitly "request this url and then call this same function again over and over"
21:58 jberger worked great until facebook bought the service and then closed it a year later
21:58 jberger but I had processes running it for months at a time
22:00 Grinnz_ FloydATC: if you want to render the response piecemeal, im not really sure how to go about that to be honest
22:01 jberger Grinnz_: write_chunk?
22:02 FloydATC The response only has to be machine readable
22:02 Grinnz_ FloydATC: the easy way is of course caching your response text up in the stash, and rendering it once when all of the calls are done, but if you really want an "endless" loop then that isnt an option
22:02 Grinnz_ the cookbook has an example of handling a streaming response from a server in the useragent, but i cant find one for actually sending a streaming response
22:03 jberger Grinnz_: that's write chunk
22:03 jberger http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Chunked-transfer-encoding
22:03 jberger or websocket of course
22:03 Grinnz_ mmm yeah thatshould work
22:04 Grinnz_ you probably want to do that as a delay, pass the $delay->begin to write_chunk for the next step
22:05 FloydATC I've been doing a lot of IOloops with $delay->begin but always with a finite number of steps so far
22:06 jberger yeah and I'd wrap one iteration of that sequence as a nonblocking method with delay
22:06 FloydATC isnert/update plus a few selects, stash the data then finally render a template and done
22:06 jberger and then call that "recursively" until done
22:06 jberger oh so yeah, you don't want to write chunk, just append to a buffer in the stash
22:07 Grinnz_ that's not an endless loop then :P
22:08 FloydATC Right but this time it needs to be endless because in theory it should keep going for hours and hours pulling work, sending data and just keep going
22:08 Grinnz_ oh you mean "finally render a template" is what you did before
22:09 FloydATC the "client" will just be monitoring for activity, killing the connection of something fails (which ideally should kill the loop)
22:09 FloydATC right. this time there's no template, just machine data
22:09 Grinnz_ As alluded to before, if possible, websockets is a much cleaner way to do this
22:09 sri Grinnz_: there is one in the timer section
22:10 sri i wouldn't mind one with a drain callback either, but can't think of a good example
22:13 sri maybe this qualifies http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Chunked-transfer-encoding
22:13 FloydATC I think write_chunk fits the bill for sending data back to the client, yes
22:16 FloydATC and ending the sub by queing another call to the sub might work, I just don't see where the UA fits into the picture
22:18 Grinnz_ it doesnt?
22:19 FloydATC So how exactly do I get an "action" to queue a call to itself? This makes no sense to me -> https://metacpan.org/source/JBERGER/Mojo-FriendFeed-0.05/lib/Mojo/FriendFeed.pm#L57
22:20 jberger FloydATC: the ua was an example of a pattern
22:20 jberger for you you'd use the nonblocking db calls in place of the ua calls
22:23 perlpilot joined #mojo
22:32 FloydATC Here's what I have: http://pastebin.com/v9KXu5AQ
22:32 sugar joined #mojo
22:33 FloydATC Consider it pseudo-code atm
22:33 jberger FloydATC: factor out the delay code as a private method
22:33 jberger then in a last step call the method again
22:34 jberger https://github.com/jberger/Mojo-ACME/blob/master/lib/Mojo/ACME.pm#L56-L72
22:34 jberger in that one the short circuit to break out of the loop is in the second step
22:35 Grinnz_ .oO(Acme::ACME)
22:35 jberger returning without calling begin prevents it from going on to the next step
22:35 jberger Grinnz_: hehe
22:37 FloydATC Ah I think I see what you mean now... finally. Sorry.
22:38 jberger no worries, nonblocking is a different way of thinking
22:38 good_news_everyon joined #mojo
22:38 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgMoj
22:38 good_news_everyon mojo/master 038aa5a Sebastian Riedel: add streaming section to rendering guide
22:38 good_news_everyon left #mojo
22:38 jberger even if you "get it", there are new patterns to learn
22:38 sri for completeness http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Streaming
22:40 jberger sri: that's a cute trick
22:41 jberger oh and it doesn't even leak because you undef it
22:41 jberger wow, that's really pretty
22:41 sri old school undef $cb
22:43 Grinnz_ heh
22:43 Grinnz_ nice
22:43 good_news_everyon joined #mojo
22:43 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgMKA
22:43 good_news_everyon mojo/master 1b32313 Sebastian Riedel: more consistent examples
22:43 good_news_everyon left #mojo
22:49 jberger right, but in doing so you also call ->write without a callback
22:53 * sri nods
23:36 good_news_everyon joined #mojo
23:36 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgMS7
23:36 good_news_everyon mojo/master f462094 Sebastian Riedel: more consistent formatting
23:36 good_news_everyon left #mojo
23:40 bradjm joined #mojo
23:43 sugar_ joined #mojo

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