Camelia, the Perl 6 bug

IRC log for #mojo, 2012-03-15

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

All times shown according to UTC.

Time Nick Message
00:12 abra joined #mojo
00:20 chansen joined #mojo
00:30 hshong joined #mojo
01:04 d4rkie joined #mojo
01:11 alnewkirk joined #mojo
01:12 scott joined #mojo
01:37 GitHub47 joined #mojo
01:37 GitHub47 [mojo] kraih pushed 1 new commit to master: http://git.io/uCOXJA
01:37 GitHub47 [mojo/master] document and test render semantics - Sebastian Riedel
01:37 GitHub47 left #mojo
02:37 kitt_vl joined #mojo
02:46 xaka joined #mojo
02:56 d4rkie joined #mojo
03:10 d4rkie joined #mojo
04:05 newbie joined #mojo
04:18 newbie joined #mojo
04:21 preflex_ joined #mojo
04:23 baton8 joined #mojo
05:20 xaka joined #mojo
07:42 Foxcool joined #mojo
08:09 pfig joined #mojo
08:22 batman joined #mojo
08:22 cosmincx joined #mojo
08:59 spleenjack joined #mojo
09:04 judofyr joined #mojo
09:19 dch joined #mojo
09:20 dch good morning!
09:20 purl Lies!
09:20 dch I need to generate a lot of test JSON, any way of doing this with mojo or any other recommended library?
09:22 random JSON (and ensure JSON::XS) is installed
09:22 random Mojo will have json rendering integrated for you
09:22 * dch has JSON::XS
09:22 dch thanks
09:22 random in your action when you are finsihed just call $self->render(json => $ref)
09:23 random just check the docs or tests for Mojolicious itself for examples
09:23 marcus paper or plastic?
09:29 random Paper is more friendly to the environment...
09:59 random joined #mojo
09:59 * sri yawns
10:01 xaka joined #mojo
10:09 daxim joined #mojo
11:13 mattastrophe joined #mojo
11:51 mattastrophe joined #mojo
11:54 marcus random: it might be.
11:55 mattastrophe joined #mojo
12:35 jnap joined #mojo
12:43 CromeDome joined #mojo
12:56 CromeDome joined #mojo
13:04 * sri is still not sure what to do about the Mojo::IOWatcher logging problem
13:05 sri "MOJO_LOG_LEVEL=debug perl -Mojo -Ilib -E'a("/" => sub { my $self = shift; Mojo::IOLoop->timer(1 => sub { $self->render(inline => "% die;") }) })->start' get /"
13:05 sri that timer error is not logged, it's just a warn()
13:05 mdom joined #mojo
13:05 kitt_vl joined #mojo
13:05 mdom Moin
13:05 * sri waves
13:06 sri something like Mojo::IOLoop->singleton->iowatcher->on(error => sub { $self->log->error($_[1]) }) could change that
13:06 mdom Is there any reason why Mojolicious::Types only accepts only a single media-range for detection the requested media type?
13:07 mdom if not, i would be happy to fork mojolicious and add support for that
13:07 mdom Mojolicious::Types->new()->d​etect("image/png,image/gif") => []
13:07 sri mdom: that was discussed in a github issue
13:07 mdom Ah, okay
13:07 sri short answer, yes, there's a very good reason
13:08 mdom Ah, i see
13:09 judofyr sri: or you can add a Controller::timer which wraps the callback
13:09 sri mdom: https://github.com/kraih/mojo/issues/237
13:09 sri judofyr: bad idea
13:09 sri timers are strictly a server feature
13:10 sri also, where does it stop?
13:10 sri there are many more event watchers
13:10 judofyr true
13:11 judofyr Mojo::IOLoop->timer(1 => $self->handle_exception_or_something(sub { … })) maybe?
13:11 * sri pokes his eyes out
13:12 mdom sri: Thanks, i read 227
13:12 judofyr sri: it just feels weird to write Mojo::IOLoop->timer(1 => sub { … }) and assume that it's somehow connected to the current response
13:12 judofyr request*
13:13 sri who assumes that it is?
13:13 judofyr hm… maybe I misunderstand
13:14 sri the oneliner i pasted above just forwards error events from the lowest layer to the application log
13:14 sri "Mojo::IOLoop->singleton->iowatcher->on(error => sub { $self->log->error($_[1]) });"
13:14 judofyr sri: by "$self" do you mean the app or the controller?
13:14 sri app
13:14 judofyr of course
13:14 sri controller has no log
13:15 judofyr yeah, that's what confused me :P
13:15 sri ah ok
13:15 sri it's still a hack though, since it breaks the server/framework barrier
13:16 judofyr and it would be weird when you have multiple apps in the same process
13:16 sri lets say you have two apps in the same server, they would both get the same error events logged
13:16 judofyr :)
13:16 sri :)
13:16 judofyr but isn't errors in timers already logged?
13:16 sri even embedded apps
13:16 sri nope, they are not
13:17 sri just warn()
13:17 sri which is a default fallback for error events without subscribers
13:17 judofyr ah, that's because of the safe_trigger (or whatever it's called?)
13:17 judofyr emit_safe
13:17 purl emit_safe is experimental though
13:18 sri it's primarily for emit_safe
13:22 judofyr sri: I don't think there's a pretty fix here. ->timer can't know if the code is app-specific or not :(
13:22 inokenty joined #mojo
13:23 sri which is the dilemma
13:25 judofyr is it that much of a problem though? the error ends up on stderr…
13:26 sri perhaps a little cookbook recipe would be the right thing to do
13:35 sri http://hastebin.com/raw/cakogeleme # something like this appended to the timers section of the cookbook
13:37 sri or is that too advanced?
13:37 mdom Mhh, it seems hypnotiad is closing the connection to my apache after 90 seconds while still quering my msql server?
13:38 mdom Weird
13:38 mdom 90 seconds isn't referenced anywhere
13:43 mdom *mrg* Forget it
13:43 GitHub91 joined #mojo
13:43 GitHub91 [mojo] kraih pushed 1 new commit to master: http://git.io/2rhc6g
13:43 GitHub91 [mojo/master] added low level event error logging recipe to cookbook - Sebastian Riedel
13:43 GitHub91 left #mojo
13:43 sri hope it doesn't scare people
13:47 sri then again, i suppose a few low level recipes are a good way to fish for feedback on the api
13:47 kitt_vl joined #mojo
13:47 random doesn't look that scary
13:48 random Is there a hint for that in Mojo::IOLoop
13:48 random so that it is clear, that errors go to STDERR by default
13:48 sri nope
13:51 sri i'm actually a little afraid to document too much
13:51 sri it's all still very experimental... and it went wrong in the past already
13:51 random understood
13:51 sri "Y U DOCUMENT IF I CAN'T USE IT!@#$%^&"
13:52 random maybe we just leave that until it leaves experimental
13:53 sri it's a catch 22 though, if i don't get feedback it can't ever become stable ;p
13:55 mattastrophe joined #mojo
13:57 random joined #mojo
14:42 sri the performance of luajit is damn impressive, wonder why nobody else has replicated that yet
14:43 mdom left #mojo
14:50 * sri has just been reading http://lists.parrot.org/pipermail/​parrot-dev/2012-March/006680.html
15:23 sri wow, sparrow for iphone is neat
15:25 smpb sri: a pity apple didn't allow for push notifications
15:28 Mikey guise... /node_info daemon --listen http://[fc5d:baa5:61fc:6ffd​:9554:67f0:e290:7535]:8000  ... that used to work
15:28 Mikey now i get .. Custom HTTPS listen values are DEPRECATED in favor of URLs!
15:28 * Mikey cries
15:29 Mikey in other news: i very much like low level recipes.  i've done much digging
15:30 sri just look at the Changes entry for that deprecation
15:30 Mikey but im not doing https?
15:30 Mikey but i will check out Changes
15:30 Mikey i AM using ipv6 tho.. but not https
15:31 sri is it just the wrong warning or does it not work at all?
15:32 Mikey doesn't work at all i'm afraid
15:32 Mikey Can't create listen socket:  at /mg2root/home/mikeyg/perl5/perlbrew/perls/per​l-5.14.2/lib/site_perl/5.14.2/Mojo/IOLoop.pm line 155
15:32 Mikey and wrong about the warning
15:32 sri ah
15:32 Mikey url parsers hate ipv6.
15:32 sri naah, that's fine
15:32 sri just the deprecation workaround eating it
15:33 Mikey ahhh!  haha that's crazy.. what's setting it off?  the []'s ?
15:33 Mikey damn those []'s to hell.  and the colons too.  damn them too.
15:33 sri the regex is a bit stupid
15:34 sri doesn't know about ipv6
15:34 Mikey where does it live?  i will teach it
15:34 Mikey i'm now telling the computer exactly what it can do with a lifetime supply of chocolate.
15:35 sri https://github.com/kraih/mojo/blob/m​aster/lib/Mojo/Server/Daemon.pm#L198
15:35 Mikey gracias senor
15:36 Mikey ahhh yes.  i'm going to just throw that out to get services running again, and then maybe do the whole git clone / pull request.. it's jsut a regex.. i am definitely interested in mojo ipv6 support
15:36 Mikey i've been doing lots of work on the cjdns project which is an ipv6 based darknet, and nodeinfo, the main search/node tracking site is written in mojo
15:36 sri well, in 3 months that ugly workaround is gone anyway :)
15:37 Mikey right.  i'll just hold off up upgrading mojo for 3 months then
15:37 Mikey (on this server)
15:37 sri i wouldn't mind a clever little hack for the meantime though
15:37 Mikey si.  i'll investigate the clever hack once things are up and running
15:39 Mikey phew.. thank you so much for pointing me right to it.  saved me a bunch of time! :)
15:39 Mikey <3 irc <3 sri
15:39 sri \o/
15:40 sri think i have a hack :)
15:40 Mikey quick on the draw
15:40 Mikey i'm still soothing my users
15:41 Mikey i haven't restarted in a long time!
15:41 Mikey lol
15:41 judofyr sri: does Mojo::UserAgent handle [] IPv& btw? I looked around a bit, but I didn't see anything that specifically targeted it…
15:41 Mikey fyi: mojo running in ipv6 == pretty effin stable.
15:41 sri judofyr: it does
15:41 judofyr or, I looked in Mojo::URL for something that returns the hostname
15:41 Mikey also mojo running in ipv6 on openwrt .. pretty awesome.
15:41 sri ipv6 is msotly not very special
15:41 Mikey im basing a HUGE project on mojo presently
15:41 sri IO::Socket::IP does most of the heavy lifting
15:41 Mikey more info soon
15:42 Mikey *nod*
15:42 judofyr sri: could you point me to where? I'm mostly wondering about the []-style IPv6 hosts.
15:42 judofyr oh
15:42 Mikey it's usually url parsers it trips up on
15:42 Mikey for the most part, mojo is very good about not chewing things up
15:42 judofyr so IO::Socket::IP just handles []-addresses?
15:42 sri it was *a lot* more complicated when we had an async resolver
15:42 Mikey this is one exception
15:42 Mikey the [] is part of the url
15:43 judofyr in Ruby, we have URI#host and URI#hostname, where URI#hostname is something you safely pass to Socket#connect
15:43 Mikey $s = IO::Socket::INET6->new(PeerAddr => '
15:43 Mikey er
15:44 Mikey $s = IO::Socket::INET6->new(PeerAddr => 'fc5d:baa5:61fc:6ffd:9554:67f0:e290:7535'); ...
15:44 Mikey no []'s
15:44 judofyr "To support the IO::Socket::INET API, the host and port information may be passed in a single string rather than as two separate arguments"
15:44 sri eww, stay away from INET6
15:44 judofyr https://metacpan.org/module/IO::Socke​t::IP#PeerHost-AND-LocalHost-PARSING
15:44 judofyr I see
15:44 sri IO::Socket::IP is much better and core now
15:44 Mikey this is for a script designed to run on old perls
15:44 Mikey part of host configuration for darknet nodes
15:45 Mikey but i will use IO::Socket::IP going forward thank you
15:45 Psyche^ joined #mojo
15:46 judofyr sri: but that explains why Mojo::URL doesn't have a distinction between host and hostname. thanks!
15:48 judofyr sri: I'm still pondering on a Mojo-in-Ruby you see :)
15:49 abra joined #mojo
15:49 kaare joined #mojo
15:49 judofyr I feel almost bad for "stealing" so many parts :(
15:49 * judofyr adds punycode to the reading list
15:50 Mikey meh it's next gen.  worth ripping off imo.  ruby's kinda bloated, needs something like mojo
15:50 Mikey wouldn't be the first time ruby stole from perl ;)
15:50 GitHub71 joined #mojo
15:50 GitHub71 [mojo] kraih pushed 1 new commit to master: http://git.io/5n1evQ
15:50 GitHub71 [mojo/master] fixed IPv6 listen value bug in Mojo::Server::Daemon - Sebastian Riedel
15:50 GitHub71 left #mojo
15:51 Mikey thx sri :)
15:51 sri that regex is still not perfect, but at least better
15:51 judofyr Mikey: I would say rails is bloated, not ruby :)
15:52 sri the interesting thing about rails is that they can turn everything around in one major release
15:52 judofyr rails is bloated in all the wrong directions…
15:53 judofyr mojo is kinda bloated (in the sense that it includes an event loop, URL parser, preforking server and whatnot)
15:53 judofyr but it's a good kind of bloat
15:53 judofyr :)
15:53 judofyr sri: I've also heard that they are working on better async version of Rack
15:54 sri i've recently proposed an async version of psgi
15:54 vel joined #mojo
15:55 Mikey it's a doesn't have any deps kind of bloat
15:55 Mikey a pure perl kind of bloat that's fast.
15:55 judofyr even an async version of psgi/rack will have problems with middleware + body input though. probably the most annoying thing about Rack: the input stream must be rewindable…
15:55 sri https://gist.github.com/2011353
15:55 sri no such problems in my version
15:56 sri breaks everything though
15:56 sri async middleware would be the only way to do it
15:56 Mikey ok you're right.  ruby is slow, rails is bloated.
15:56 Mikey i got mixed up
15:56 sri there are some hidden gems in rails though
15:56 judofyr Mikey: :)
15:56 * sri likes the instrumentation layer
15:57 Mikey i love the lack of orm in mojo
15:57 sri it's horribly slow, but you can change every log message with a plugin!
15:58 Mikey for the longest time, this was the only framework i used..  http://cpansearch.perl.org/src/MGREGO​RO/WWW-Romeo-0.21.01/lib/WWW/Romeo.pm
15:58 Mikey mojo was the first thing to compel me to actually embrace a framework i didn't write
15:59 sri mod_perl :D
15:59 Mikey mp2 .. i wrote a cms called BadNews, which i ended up using as-is as a "mvc-esque" framework to power http://www.virtuemeter.com
15:59 judofyr Mikey: I had the same situation with https://github.com/camping/camp​ing/blob/master/lib/camping.rb (at least for personal projects)
15:59 Mikey when i split the cms functionality out of BadNews i created Romeo (framework only, mp2) and Juliet (a collection of cms tools)
16:00 Mikey Juliet is still modperl 1
16:00 Mikey apache 1.3
16:00 purl apache 1.3 is far more stable and time tested. and it has lots more shit that just works with it.
16:00 Mikey i used VirtueMeter as a test.. i knew Romeo was done when VM ran unmodified
16:01 Mikey judofyr: haha nice.. one liner :)
16:01 Mikey well.. could be.  *rubs eyes*  whats with the formatting?
16:02 * sri wonders if camping predates sinatra
16:02 judofyr sri: it does
16:02 judofyr Mikey: it only gets alligned for releases
16:02 judofyr aligned*
16:02 judofyr sri: 2006
16:02 sri :o
16:02 Mikey BadNews is 2004, Romeo 2006
16:02 Mikey romeo's latest (and last) project is Praux.com
16:02 judofyr Mikey: this one is better aligned: https://github.com/camping/ca​mping/blob/2.1/lib/camping.rb
16:02 Mikey which i will be porting to Mojo soon
16:03 Mikey but i have handlers that dispatch to other handlers, etc
16:03 Mikey it's quite ugly, and needs to be refactored
16:05 * sri always like the camping views and thought those would fit very nicely into a more sinatra-ish router
16:05 sri *liked
16:06 judofyr I think it would be hard within 4k
16:08 sri https://gist.github.com/2011353#gistcomment-91964 # :D
16:09 judofyr sri: just so I can pass it along to other guys who's interesting in async + Rack :)
16:09 judofyr interested*
16:11 judofyr sri: now that I already have your attention: different template lookup path per request; is it possible? where is it documented?
16:13 tempire_ joined #mojo
16:13 sri sync yes, async no
16:13 sri just replace app->renderer->paths brefore rendering and reset after
16:13 judofyr ah :(
16:14 sri or actually
16:14 sri you can make it a helper
16:14 sri that should always work
16:14 * sri nods
16:14 judofyr what about implicit rendering?
16:14 sri *if* the renderer respects paths at all
16:15 sri TT for example doesn't i think
16:15 judofyr oh
16:15 judofyr :(
16:15 sri explicit only i think
16:15 sri you'd need a new hook otherwise
16:16 sri after_routes_dispatch or so
16:16 judofyr ($app ? (INCLUDE_PATH => abs_path($app->home->rel_dir('templates'))) : ()),
16:16 judofyr damn TT renderer :(
16:16 sri well, multiple template paths is only a few weeks old :)
16:17 judofyr oh :)
16:17 judofyr but few weeks in Mojo is like three minor releases in other frameworks…
16:17 sri ;p
16:17 judofyr aha: %{$args{template_options} || {}},
16:18 * judofyr wonders if TT supports multiple include paths
16:18 judofyr appearently it does
16:19 judofyr but it's a string…
16:19 sri anyway, why would you change paths between requests?
16:20 judofyr maybe it's overkill to change the path between requests… I just want to render a mobile template if the user is on the mobile site.
16:21 judofyr and I think falling back to the regular templates makes sense
16:21 judofyr (we're not 100% sure yey)
16:21 sri i see
16:22 judofyr and now we have lots of implicit rendering and ->render('controller/action')
16:22 judofyr which we would prefer to *not* change
16:24 judofyr sri: any ideas?
16:24 judofyr other than trying to change TT's INCLUDE_PATH
16:25 judofyr sri: I could have two renderers.
16:25 judofyr sri: one that has the templates/mobile in front
16:26 judofyr and the regular one
16:26 purl somebody said the regular one was fine for that, I've watched movies on it
16:26 judofyr sri: is the renderer cached somewhere, or is it safe to app->renderer($foo) ?
16:27 judofyr or maybe different handlers…
16:28 judofyr still going to have problems with keeping the changes in the current request/response-cycle
16:30 judofyr ah
16:30 judofyr renderer->render is called with the $c
16:30 sri different format maybe
16:30 sri .mobile.tt
16:31 judofyr hm…
16:31 judofyr that definitely sounds like less hacky
16:31 sri i've not thought much about this though, there are many options
16:32 judofyr sri: how is format handling done btw? is it the template renderer's responsibility? or do you simply pass in "foo.html.tt" ?
16:32 judofyr (you as in M::Renederer)
16:33 sri depends on handler
16:33 sri we just make suggestions and provide helper methods for detection
16:35 judofyr sri: my $t = $renderer->template_name($options)
16:35 sri supporting multiple template engines at the same time is not very common in perl, so it's a little hacky
16:35 judofyr that means it does the correct thing?
16:35 marcus ->dtrt
16:35 sri http://mojolicio.us/perldoc/Mojolicious/Guides/​Rendering#Adding_your_favorite_template_system
16:38 judofyr next question: is there a public way to change the format? I see that ->stash says that it's reserved
16:39 judofyr I guess I can just ->stash->{format} = 'mobile'
16:44 judofyr sri: hm… then it doesn't fall back to the HTML format though :/
16:46 marcus I don`t understand why you need the fallbacks.
16:46 judofyr marcus: I'm not sure if we need it either. but it can be useful to share templates where possible.
16:46 marcus you can do that by including template parts tho.
16:46 marcus probably saner.
16:47 marcus and would encourage some much needed refactoring of the templates... ;)
16:47 judofyr true
16:49 judofyr let's try with "$self->stash->{format} = 'mobile' if ($self->param('_mobile'));" for now and see how it works.
16:50 * judofyr needs to figure out how to detect/choose mobile site later
16:57 * sri wonders if the sparrow app design will become a thing
17:02 d4rkie joined #mojo
17:02 judofyr sri: for iOS? what part?
17:03 sri the card layout
17:03 judofyr didn't Facebook kinda start that?
17:04 judofyr sri: also, we did it before Sparrow: http://nordaaker.no/siste/
17:04 sri oh
17:04 * sri doesn't use the facebook app
17:04 marcus path also does it
17:04 marcus every fucking app is copying the facebook implementation atm
17:04 marcus like meetup.com app
17:05 marcus and the app I'm sending in tomorrow :p
17:05 * judofyr turns himself off
17:07 hugh joined #mojo
17:26 kanishka joined #mojo
17:51 batman joined #mojo
17:51 batman joined #mojo
18:24 pfig joined #mojo
18:24 pfig_ joined #mojo
18:35 tempire_ sri: instrumentation layer?
18:35 tempire_ ack
18:36 sri tempire: http://api.rubyonrails.org/classes​/ActiveSupport/Notifications.html
18:37 tempire chrome doesn't prompt to translate the nordaaker language
18:37 tempire :(
18:54 xaka joined #mojo
19:29 mattastrophe joined #mojo
19:32 GabrielVieira joined #mojo
19:33 phillipadsmith joined #mojo
19:37 batman joined #mojo
19:39 GabrielVieira Hey, i'm writing a plugin, but I want  to use it's helper without parenteses, like get, post, etc... but it only works with parenteses.... Code: http://pastebin.com/RZhnfWrh Error: String found where operator expected at test.pl line 6, near "mysub '/test'"
19:42 sri that's not how helpers work, you can't extend the lite dsl
19:43 sri you can only do app->mysub(), that's it
19:44 Mikey whats all that's sufficient for subclassing Mojolicious::Controller?  just use Mojo::Base it in your derived class and controller_class() in startup() ?
19:45 GabrielVieira sri: mysub() works, but not without the (). there is a way to have it working without ()?
19:45 sri GabrielVieira: that's accidental, *not* a feature
19:46 GabrielVieira :)
19:46 sri you'll never get rid of the ()
19:46 GabrielVieira oh :T
19:46 sri that check is compile time
19:46 sri even if you actually exported new functions from the plugin call, it would be too late
19:46 sri the whole plugin loading process would have to be moved to compile time
19:48 GabrielVieira humm
19:48 GabrielVieira so, it wont be a plugin
19:48 GabrielVieira sri: any possibilite of having event_source as we have websocket?
19:49 GabrielVieira event_source '/event' => sub {}; ?
19:49 sri what would be the point?
19:50 GabrielVieira write the event_source code as easy as I write the websocket one
19:50 sri please elaborate
19:55 GabrielVieira sri: http://pastebin.com/1Ncu5Dnm
19:55 GabrielVieira but without parenteses
19:56 sri eww
19:56 sri we do not hack into ioloop to change the timeout automatically
19:56 sri besides, from a routing perspective an event_source keyword makes no sense whatsoever
19:57 sri since they are indistinguishable from normal requests
19:57 sri very much unlike websockets
19:58 sri the emit helper makes sense though
19:59 sri i can assure you, *that* is not at all what the websocket keyword does
20:00 GabrielVieira i understand
20:01 GabrielVieira but you agree would be easier to develop EventSource apps
20:01 sri due to the emit helper
20:01 sri i disagree about the keyword
20:03 sri https://gist.github.com/1046452 # that's my take on it btw
20:03 sri long time ago
20:05 sri you can theoretically make it work
20:05 * sri takes his never from earlier bacl
20:05 GabrielVieira opening
20:06 sri that one even went one step further and made *all* helpers work
20:08 sri on_process is now the around_dispatch hook
20:09 Mikey what role do you feel violence plays on modern software development?
20:10 GitHub155 joined #mojo
20:10 GitHub155 [mojo] kraih pushed 1 new commit to master: http://git.io/3M_dww
20:10 GitHub155 [mojo/master] no need to set a domain for bonjour publishing - Sebastian Riedel
20:10 GitHub155 left #mojo
20:30 tempire GabrielVieira: having a keyword wouldn't really work.  I had the same thought, but websockets are a continuous connection, whereas event source is one way.
20:30 pfig joined #mojo
20:30 tempire you need more infrastructure to make it work
20:30 tempire which is perfectly achievable, but it's not the role of the core framework.
20:31 pfig_ joined #mojo
20:31 tempire a plugin would have to handle coordinating messages across multiple forked daemons
20:47 lukep joined #mojo
20:56 GabrielVieira tempire: humm I'll check that
21:54 vervain joined #mojo
21:56 perlite joined #mojo
22:33 tm joined #mojo
22:33 tm good evening :)
22:35 tm if someone would be so kind... I have two newbie questions ;)
22:36 tm how to change inactivity_timeout for one route? I have something that takes sometimes >20sec and don't want the connection to close just yet...
22:40 tm hmm just had in idea - use Mojo::IOLoop to write chunk (like single space to keep link open and don't close the connection) and once the full result is ready spit out the whole lot
22:42 xaka tm: from doc - Mojo::IOLoop->stream($c->tx-​>connection)->timeout(300);
22:43 tm tnx xaka, dully noted
22:44 tm brb, testing ;)
22:44 xaka tm: http://mojolicio.us/perldoc/Mojolicious/Controller (found there, search for "timeout" keyword)
22:49 tm thank you
22:52 sri that api is experimental though
22:52 sri in fact, i'm considering to change it right now :o
22:53 tm hmm
22:54 tm so which way to go? change timeout or work around chunked transfer too keep link alive as long as needed?
22:55 sri i'm afraid the only stable option is to change the timeout global
22:55 sri (or work around)
22:55 tm basicaly I have daemon processing queue created via mojo, it returns files to known location, mojo needs to detect -e $file and send response to browser
22:55 tm ok in other words don't do it per route :D
22:55 tm understood
22:56 sri or accept that the api will change
22:56 tm api for IOLoop?
22:56 sri for changing the timeout
22:56 sri i'm considering $tx->connection->timeout(300)
22:57 tm ahhh ok, so I'll play with IOLoop for now, see if I can get it done this way
22:57 sri pretty much all of ioloop is experimental too
22:57 sri basically the whole io layer
22:57 tm what's not? :)
22:58 sri everything else
22:58 purl i think everything else is just bloated same old same old
22:58 xaka joined #mojo
23:00 sri my plans just crashed though, no change
23:01 sri i really want to make Mojo::IOLoop->stream($c->tx-​>connection)->timeout(300); shorter, but there are very few options :(
23:04 jwang joined #mojo
23:05 tm changing timout works for sure
23:11 tm this works http://pastebin.com/sJAP7KJg without changing global timeout
23:11 tm and in morbo it shows request completed when first chunk is sent... then following chunks get processed as well
23:12 tm as expected
23:12 sri i think ->write(' '); works too
23:13 sri that's how twitter keeps connections alive
23:13 tm hmm
23:14 tm any major difference between write and write_chunk that should make me consider using the other one?
23:14 xaka what about $c->tx->timeout(3000)? is it possible to implement?
23:14 tm yes as Mojo::IOLoop->stream($self->t​x->connection)->timeout(300); in sub dispatched via route - it worked
23:15 sri not possible to implement
23:15 tm sri - worked here or I messed up massively :D
23:15 * tm tends towards option 2
23:15 sri tm: not you
23:16 tm one reason I prefer chunks over timeout is that in case of extreme situation and very long transaction, client may timeout, not server... ;-) so sending something takes care of timeout on both sides, that's all
23:18 sri the fact that Mojo::IOLoop->stream($self->t​x->connection)->timeout(300); gets commonly used now makes me very unhappy :(
23:18 sri at some point it will become very hard to change, even though it's experimental
23:18 sri marcus, tempire, crab: this problem needs some attention
23:19 tm sri: what's the motivation for keeping timeout low except for possible resource exhaustion/(D)DoS?
23:19 sri that's the motivation
23:19 tm awesome
23:20 tm I prefer to use a bit more bandwidth and have lower timeout :-D been DDoS'ed several times and learned that every second counts
23:21 sri you can't prevent ddos
23:21 sri just make dos harder
23:21 tm but I can ease it a bit if timeouts are right
23:21 tm anyway when load balancers say kthxbye, it's game over anyway :D
23:21 sri ddos usually means ip or subnet change
23:22 tm lets put it this way... they get you on L7, you mitigate (somehow), then they hit you on L3 and then you have a real problem
23:23 tm and hosting even static content is a problem, so this is out of scope anyway because you can't mitigate link saturation this way
23:24 tm but for me personally shorter timeout is in general better - rarely use keep-alive on servers >4-5sec
23:25 sri per connection timeout changes will be rather common in the future though, especially for websockets
23:27 sri sadly i'm still very unsure about the Mojo::IOLoop->stream() api, so stabilizing is not really possible yet
23:30 tm there's a reason for K.I.S.S. :)
23:31 sri if only there was such a thing as a simple event loop ;p
23:31 tm ;)
23:32 tm guys... I really bow to your wisdom because what you did with Mojolicious is awesome - bringing fun and efficiency back to webapp dev - achievement unlocked
23:32 sri glad you like it
23:33 tm and the features blow my mind anyway
23:33 tm like it... love it and showing my c*** code to friends - already have several converts :D
23:34 tm ok back to docs, really want to finish this bit of the code I'm working on
23:36 sri bet if i declared the ioloop api stable i would have at least two proposals for a full redesign by tomorrow :)
23:36 tm ;)
23:51 GabrielVieira joined #mojo

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