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

IRC log for #mojo, 2016-02-15

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

All times shown according to UTC.

Time Nick Message
00:18 melo1 joined #mojo
00:22 sri i guess it's good to union all if you can, gives postgres the opportunity to optimize if it ever gains the capability
00:22 sri which is not too far fetched, since parallel queries are a thing in 9.6
00:31 lluad It'll save you a round trip, which might be relevant in some setups.
00:32 * lluad gestures vaguely at The Cloud
01:00 jontaylor joined #mojo
01:19 * sri nods
01:30 stryx` joined #mojo
01:34 sri actually, i should just make it one query
01:41 sri oh no, that's slower
01:42 sri because i have to typecast state::text
01:42 sri from enum to text
01:42 sri that turns 135 calls/s into 100 calls/s
01:46 jontaylor_ joined #mojo
01:46 sri ah, i can change the group by to make it faster again :)
01:50 sri now it's even measurably a tiny bit faster
01:51 sri https://github.com/kraih/minion/commit/3e8da2f2e3c75273b6dd073b2596752db48fb6b9
01:51 sri "group by 1" had to become "group by state" to avoid a slow down from state::text
02:01 captbipto joined #mojo
02:32 bpmedley http://xwalk.github.io/2016/01/31/Static-server-languages-performance/ <-- What's a good retort for this article that could include Mojolicious?
02:33 bpmedley I was thinking of something like: https://bitbucket.org/snippets/bpmedley/6b94K
02:33 preaction "testing different static site generators" <- what?
02:34 sri smells like a troll post
02:34 bpmedley How do you mean?  I assume they just don't know enough perl to create a valid Modern Perl example..
02:34 sri that benchmark couldn't be more php biased
02:35 sri honestly, i think anything you do would be a waste fo energy
02:35 bpmedley Understood
02:35 preaction mojolicious isn't a static site generator, for one
02:36 sri yea, the static site generator references make no sense at al
02:36 preaction the entire point of a site generator is that you can serve them with something optimized for piping plain files out over a network
02:36 sri how do you even find that garbage?
02:36 bpmedley preaction : That's true, I just felt it awkward that they were using a odd http server module for perl..
02:37 bpmedley sri : I read the PHP code.. :-0
02:37 preaction their python example is also obvious trolling.
02:38 bpmedley https://www.google.com/?gws_rd=ssl#q=ruby+vs+perl+inurl:2016 <-- this might be inviting awkwardness .. ;)
02:38 preaction if they wanted to test best practices, they'd've actually looked for some
02:38 bpmedley That makes sense.  Thanks for the reference points, I'll leave it be..
02:39 sri if they let you you could comment with a reference to the web framework benchmarks
02:39 sri but they prolly won't let you
02:39 sri https://www.techempower.com/benchmarks/
02:44 sri jberger: umm, did those benchmarks really use the versions from cpanfile.snapshot? :O
02:46 sri https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Perl/mojolicious/cpanfile.snapshot#L137
02:46 sri that was before statement handle caching
02:46 jberger it should be
02:46 jberger I need to update it
02:46 sri there have been huge performance improvements since
02:46 jberger I tried about a month ago and I couldn't get their vagrant setup working
02:56 sri oh, celery has a very interesting approach to rate limits
02:57 sri looks like each worker keeps an internal table and when the table changes they send a broadcast to all other workers announcing the change
02:59 sri in fact, they allow their workers to be reconfigured via broadcast messages
03:05 mspo there isn't a mojo::xml, is there?
03:05 jberger mspo: you can use Mojo::DOM with the xml setting enabled
03:05 jberger and it enables by default if it sees an xml document line (or whatever that's called)
03:06 noganex joined #mojo
03:06 preaction prologue
03:06 sri xml declaration
03:06 sri http://mojolicious.org/perldoc/Mojo/DOM#CASE-SENSITIVITY
03:10 geheimnis` joined #mojo
03:25 mspo okay I have the start of a pure-mojo aws client
03:25 mspo well just using mojo::ua to make requests and mojo::dom to parse the resposes
03:26 mspo although I'm not sure mojo::dom is so memory-efficient
03:31 sri certainly is not
03:33 genio aws APIs can return JSON, right?
03:34 mspo I know the aws command can
03:34 mspo but I don't see how to request json from s3's rest api
03:35 mspo aws/boto is also not very memory-efficient
03:35 genio If you send the accept/content type headers, etc. does it not change what you get in response?
03:36 genio If you say you will accept anything, they give you XML.  If you say you'll accept JSON, they'll give you JSON?
03:36 mspo I'll try it
03:37 genio what endpoint are you hitting?
03:38 mspo s3.amazonaws.com
03:41 genio Well, a cursory glance says I'm wrong and the S3 API has been crappy for ages.  :/
03:42 genio http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGET.html
03:42 genio "A 200 OK response can contain valid or invalid xml. Make sure to design your application to parse the contents of the response and handle it appropriately."
03:42 genio so, sorry.  There goes that idea
03:42 mspo indeed
03:43 mspo "valid or invalid"
03:43 mspo enjoy that ;)
03:44 * genio steers clear of XML as it's pretty much the devil (especially when it can be "invalid").
03:47 mspo normally I just use XML::Simple + Data::Dumper
03:47 mspo but that's at my work where I get man GB of ram
03:47 mspo vs personal world where I'm on ec2
03:48 mspo anyway I'm happy I got the hmac256 signature stuff figured out
03:49 genio really steer clear of XML::Simple
03:49 mspo why's that?
03:49 mspo I've always used twig
03:49 mspo err- also
03:50 genio 22:49 <perlbot> XML::Simple commits the fatal flaw of trying to massage complicated and often irregular XML into the simple and highly regular world of perl data structures.  Irregularities cause "not a hashref" sort of errors in your program. Use a real parser. see: xml
03:50 genio easier to quote perlbot
03:53 mspo a sf.net link and everything
03:53 mspo although sf.net was just sold
03:53 mspo Last updated: March 18, 2008
03:55 mspo it looks like I'm up to date on that one, actually ;)
03:56 jberger http://shadow.cat/blog/matt-s-trout/mstpan-3/
03:56 jberger "No. No no no no no no no. XML is not a perl data structure."
03:57 genio jberger++   That link should likely be added to the perlbot factoid
04:07 sri if you want memory efficient you use a SAX parser, not DOM
04:23 jberger anyone want to read over the doc for my mocking module: https://github.com/jberger/Mock-MonkeyPatch (xpost from #toolchain)
04:41 preaction am i allowed to mock it?
04:50 * jberger mocks preaction
04:51 * sri mocks jberger
04:51 jberger preaction: I am interested in your opinion though
04:51 * jberger stands mocked
04:51 preaction i hit the star button, what more do you want from me?!?!
04:52 jberger Did it seem useful/different enough from its peers?
04:52 jberger I know you have used several others
04:53 jberger I wanted a perly version of python's mock class
04:57 jberger Anyway I needed to mock some things in my acme client tests and I found myself wanting the mock module we made at $work
04:58 preaction it seems a bit nicer than Test::MockObject::Extends, which seems to be closest in functionality
05:06 sri so, nobody has opened a DBD::Pg ticket for $DBDPG_DEFAULT?
05:07 absolut_todd joined #mojo
05:19 inokenty-w joined #mojo
06:29 cpan_mojo Test-Mock-Time-v0.1.1 by POWERMAN https://metacpan.org/release/POWERMAN/Test-Mock-Time-v0.1.1
06:33 sri really annoying
06:33 sri now i need $DBDPG_DEFAULT
06:34 sri https://gist.github.com/anonymous/8b9c5fa349c97d015ef4
06:35 sri that's what i wanted to do
06:35 sri you also can't coalesce(?, default)
06:35 sri :(
06:40 sri and just as i say that i get it to work ;p
06:40 sri not sure if the solution is sketchy though
06:41 sri coalesce(?, nextval('minion_workers_id_seq'))
06:41 sri ¯\(°_°)/¯
06:42 sri what can you do when DBD::Pg is broken
06:45 sri allright, someone tell me if i'm making a huge mistake :) https://github.com/kraih/minion/commit/706ffc293edb98b96421cb0f0584a366fe7a6975
06:45 batman stephan48: DBIx::TempDB makes a real temp db ...
07:00 cpan_mojo Mojo-SQLite-0.021 by DBOOK https://metacpan.org/release/DBOOK/Mojo-SQLite-0.021
07:11 Lee joined #mojo
07:18 jontaylor joined #mojo
07:29 McA joined #mojo
07:35 crab joined #mojo
08:03 sugar__ joined #mojo
08:07 osfabibisi joined #mojo
08:22 Vandal joined #mojo
08:28 AndrewIsh joined #mojo
08:36 vytas joined #mojo
08:51 berov joined #mojo
09:29 melo joined #mojo
10:30 bowtie joined #mojo
10:54 dvinci joined #mojo
11:24 bowtie joined #mojo
11:27 melo joined #mojo
11:30 bowtie_ joined #mojo
11:31 kaare joined #mojo
12:01 stryx` joined #mojo
12:15 bowtie joined #mojo
12:18 ashimema joined #mojo
12:21 mcsnolte joined #mojo
12:36 bowtie_ joined #mojo
12:45 bowtie_ joined #mojo
12:51 bowtie_ joined #mojo
12:56 batman bpmedley: does Minion::Backend::mysql work?
12:57 * batman adds https://github.com/jhthorsen/mojo-mysql/pull/25
13:06 cpan_mojo Swagger2-0.73 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Swagger2-0.73
13:06 batman or maybe i should ask jberger ...?
13:08 cpan_mojo Mojo-mysql-0.14 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-mysql-0.14
13:18 bowtie joined #mojo
13:20 punter joined #mojo
13:23 bowtie_ joined #mojo
13:32 bpmedley batman : It used to.. Perhaps you might ask jberger if he still uses it..
13:36 kes joined #mojo
13:39 batman bpmedley: ok.
13:42 cpan_mojo Test-Mock-Time-v0.1.2 by POWERMAN https://metacpan.org/release/POWERMAN/Test-Mock-Time-v0.1.2
13:49 kes is this a right way to merge param into responce: $c->res->headers->content_location->query->merge( key => 'value' )
13:49 kes ?
13:55 jberger kes: is content_location already a Mojo::URL object?
13:55 jberger batman / bpmedley : it does seem to be working, it's there reason to suspect it wouldn't?
13:59 kes jberger: http://paste.scsys.co.uk/505560
14:00 stryx` joined #mojo
14:00 jberger If the header is location, why would you expect it to be content location?
14:01 kes I try every variant. It is unlean for me from doc which I should use
14:02 jberger Location and Content-Location are different headers
14:02 jberger what are you trying to do?
14:03 kes I am trying to add param to the URL when redirecting to
14:04 batman jberger: yeah. Mojo::mysql didn't have auto_migrate() until an hour ago :)
14:05 jberger kes: try something like $c->redirect_to($c->url_for(...)->query->merge(...));
14:05 kes no, I do not want do that in every controller
14:05 jberger accessing it via the header is rather late
14:06 jberger kes: "no, I don't want to" ??
14:06 kes I do that at after_dispatch hook
14:06 jberger abstract it out however you want
14:07 jberger you can modify the headers in the response of course
14:07 batman jberger: oh! i misread... auto_upgrade is called from Minion::Backend::Pg
14:07 batman yeah... well :)
14:07 jberger access the value, copy/convert it to a Mojo::URL, add the query, set the header again
14:07 batman https://github.com/kraih/minion/blob/706ffc293edb98b96421cb0f0584a366fe7a6975/lib/Minion/Backend/Pg.pm#L79
14:08 jberger batman: I'm assuming Minion::Backend::mysql doesn't do that
14:08 jberger should it?
14:09 batman jberger: not sure. guess it would be nice if the two backends shared some code, but i guess the end result will be the same
14:09 jberger bpmedley has tried to keep it up to date
14:09 batman yeah, it's probably up-to-date-enough :)
14:09 jberger but now that he has moved on I'm not sure if its as high of a priority for him
14:09 kes http://paste.scsys.co.uk/505561
14:10 jberger kes: Mojo::Headers are just getter/setters
14:10 jberger get the value out, transform it, then set it again
14:10 jberger content_location is not relevant
14:11 jberger https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields
14:11 jberger location is what you want: https://en.wikipedia.org/wiki/HTTP_location
14:11 kes $c->res->headers->{ headers }{ location }[0]->merge( param => 'value' );
14:11 kes is this OK?
14:12 jberger why are you using the data access form? use the methods
14:12 jberger no, direct access is never ok
14:12 jberger $c->res->header->location
14:13 kes this is plain string, not Mojo::URL object
14:13 kes ((
14:14 jberger because of normalization I assume
14:14 HtbaaPi joined #mojo
14:15 kes internally it is stored as Mojo::URL
14:15 jberger I could as easily call $c->redirect_to('http://some.string.url.com') and then I doubt it would be a Mojo::URL
14:15 jberger which is why one normalizes: in order to have a consistent form
14:19 kes I should create new one, like: Mojo::URL->new( $c->res->headers->location ) . Yes. Thank you jberger
14:19 jberger right
14:19 jberger np
14:23 cpan_mojo Tapper-MCP-MessageReceiver-5.0.0 by TAPPER https://metacpan.org/release/TAPPER/Tapper-MCP-MessageReceiver-5.0.0
14:27 TomW0rk joined #mojo
14:40 mullagain joined #mojo
14:56 asarch joined #mojo
14:58 mcsnolte joined #mojo
15:12 melo joined #mojo
15:21 chienjo joined #mojo
15:37 stryx` joined #mojo
15:37 jberger oh hey, at some point I passed marcus https://github.com/kraih/mojo/graphs/contributors
15:39 jberger it would have been this one: https://github.com/kraih/mojo/commit/1038834fe22ccbe3934cc3b8534abed72882082e
15:40 jberger maybe I should have committed all that backport from the transaction refactor :P
15:40 jberger not that I actually care at all
16:04 PryMar56 joined #mojo
16:28 good_news_everyon joined #mojo
16:28 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgH4W
16:28 good_news_everyon mojo/master 1650388 Sebastian Riedel: fix a few typos (closes #909)
16:28 good_news_everyon left #mojo
16:29 sri so, i guess there is nothing wrong with this upsert after all? https://github.com/kraih/minion/commit/706ffc293edb98b96421cb0f0584a366fe7a6975
16:35 jberger sri: not that it matters much, but does that increment the next worker id even if it isn't used?
16:36 sri i don't know
16:37 jberger if it doesn't defer evaluation of the arguments of coalesce I would guess that it does
16:38 sri that would suck
16:39 jberger does it even need that?
16:39 jberger id is the value that is going to conflict
16:39 jberger just don't set it
16:40 sri nope, it doesn't
16:40 sri just tested
16:40 jberger really? neat
16:40 jberger wait, now I'm confused
16:40 jberger it does increment each time or it does not
16:40 sri it does not increment each time
16:41 sri and how would i just not set it?
16:41 jberger hmmm, nevermind, that wouldn't work at all
16:41 jberger but if yours doesn't increment then do that
16:42 jberger and neat to learn that coalesce defers execution
16:43 sri btw. i tested it with a running worker with a hearthbeat interval of 5 seconds, and running "select nextval('minion_workers_id_seq');" in a psql session
16:44 sri only the initial upsert increments it
16:46 sri ah
16:46 sri "Like a CASE expression, COALESCE only evaluates the arguments that are needed to determine the result; that is, arguments to the right of the first non-null argument are not evaluated."
16:46 jberger cool
16:46 sri not just a side effect \o/
16:46 sri <3 postgres
16:52 bradjm joined #mojo
16:56 lluad joined #mojo
17:08 punter joined #mojo
17:31 sri theoretically it should be possible to do "$id || $DBDPG_DEFAULT"
17:31 sri but DBD::Pg is broken
18:18 cpan_mojo Test-Mock-Time-v0.1.3 by POWERMAN https://metacpan.org/release/POWERMAN/Test-Mock-Time-v0.1.3
19:13 sri hmm
19:14 sri so, how should the minion worker command handle signals? right now INT and TERM mean graceful shutdown, which is very unuausl
19:14 sri *unusual
19:15 sri tempted to switch it around to QUIT for graceful shutdown, and TERM/INT for immediate
19:16 pink_mist I'd +1 on that, but I'm not really a user of minion (yet)
19:22 sri celery has is switched around, QUIT for immediate shutdown and TERM for graceful
19:24 jberger it might be more semantically correct but common usage is to ^C and they probably usually want graceful
19:27 sri resque uses INT/TERM for immediately and QUIT for graceful
19:33 sri https://github.com/kraih/minion/commit/7bc596c74f6d7a6ad96d52995968be3c39d1991f
19:34 sri that's inconsistent with the prefork server in mojo, but more dwim
19:55 mspo TERM is default signal
19:57 sri ?
19:58 mspo kill pid sends 15/TERM
20:01 pink_mist seems postgresql also has it switched around http://www.postgresql.org/docs/current/static/server-shutdown.html
20:02 jberger pink_mist: intereseting
20:07 mspo java uses 3 (QUIT) for thread dumps
20:07 dvinci joined #mojo
20:08 sri that is actually the official purpose of QUIT
20:08 sri "The SIGQUIT signal is sent to a process by its controlling terminal when the user requests that the process quit and perform a core dump."
20:38 stryx` joined #mojo
20:50 sandeep joined #mojo
20:51 sandeep hi all
20:51 sri o/
20:51 sandeep Looking at the Mojolicious::Plugin::Minion can I declare the tasks in a separate namespace ?
20:52 sandeep I have couple of tasks and the main App module is way too long to read now
20:52 sandeep I mean whats the best practice for this
20:52 sri http://mojolicious.org/perldoc/Minion#GROWING
20:52 sandeep doh!
20:52 sandeep thanks
20:52 sri :)
20:52 sandeep man this has to be the best irc ever
21:28 stryx` joined #mojo
21:56 mishanti1 Has anyone here made support for SSO with Azure AD in a mojolicious app? Any tips on modules to use / stay clear of?
21:58 mishanti1 I've been looking at Mojoliciou::Plugin::OAuth2, but I'm not entirely sure it'll fit the bill. Also found OIDC::Lite, which seems to be geared directly towards OpenID Connect.
22:09 nfg joined #mojo
22:19 wingfold joined #mojo
22:24 sugar__ joined #mojo
22:34 dvinci joined #mojo
23:21 mitya joined #mojo
23:29 bpmedley batman / jberger : I don't know how to configure mysql well enough to support the backend..

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