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

IRC log for #mojo, 2017-12-06

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

All times shown according to UTC.

Time Nick Message
01:21 jberger Advent calendar, now available in calendar form! https://mojolicious.io
01:22 jberger tweet announcement: https://twitter.com/joelaberger/status/938216271971221504
01:23 lodin joined #mojo
01:30 tibtib joined #mojo
01:30 CandyAngel Came back to my IRC and I just have, in my typing area thing: "jberger: Do you "
01:31 CandyAngel I have no idea what I was going to ask..
01:31 Grinnz well, do you?
01:32 Grinnz jberger: fyi the "Dudley Storey" link goes to a nonexistent domain
01:32 jberger hehe
01:32 jberger ?
01:32 * jberger checks
01:32 jberger damn
01:32 jberger ok well that's right out of his blog page, it doesn't work there either
01:34 jberger fixed, thanks
01:34 CandyAngel Nope, can't think what it was at all. Time for bed, so I will just say thanks again for writing that request_flow thing :P
01:36 jberger CandyAngel: nn
01:37 CandyAngel Night everyone
01:48 PsimanX1 joined #mojo
03:03 karjala_ joined #mojo
03:22 karjala_ joined #mojo
04:16 karjala_ joined #mojo
05:07 napoleon joined #mojo
06:02 lodin joined #mojo
06:22 inokenty-w joined #mojo
06:29 ghenry joined #mojo
06:37 Vandal joined #mojo
07:10 geospeck joined #mojo
07:11 preaction Grinnz: i think i changed my mind and you're right: it should be easy enough to add some built-in auth to yancy that users can use. and for some reason i also want to make a basic site cms to start from (blog, pages, comments, users)
07:14 dod joined #mojo
07:21 dod joined #mojo
08:01 karjala_ joined #mojo
08:12 jberger ok I think I may have gone overboard with this example ;-P
08:12 jberger https://twitter.com/joelaberger/status/938319895963586561
08:12 jberger preaction: tag you in tomorrow?
08:14 preaction sure, that'll be fine. files are here: https://github.com/preaction/preaction.me/tree/master/draft/2017/12/04 they should work. if they don't, probably bug in statocles
08:14 preaction also, if you've got time in the next few days, would like to run something by you since you've got the most Mason experience of anyone i know and need to make sure i'm not doing something super extra terrible
08:15 jberger heh
08:15 jberger I mean, usually when I was learning about terrible things in Mason it was just enough to know that they did and then I undid them :-P
08:15 jberger but sure
08:16 preaction my mason experience is _old_, but i have an idea for my new cms thing that i want to make sure isn't a terrible idea (and i can't come up with any reason not to do this, which is scarying me)
08:16 preaction but it's late and i should get to bed
08:16 jberger are you aware of the mason book?
08:16 jberger http://masonbook.houseabsolute.com/
08:16 preaction no, but meh. i'm not working on a mason site, i'm doing something that kind of resembles what mason does
08:16 jberger that's basically the only way I was able to do anything at $job[-2]
08:17 jberger ah ok
08:17 jberger anyway, definitely bed
08:17 jberger o/
08:31 trone joined #mojo
08:32 kes joined #mojo
08:33 kes Hi.
08:34 CandyAngel Morning kes
09:16 kes joined #mojo
09:44 geospeck joined #mojo
09:52 stephanj is there a way to tell via an event when the server(Daemon, Morbo, Hypnotoad-master) is started and ready to serve requests?
10:00 tyldis IS there something out of the box for serverside sessions? A colleague has session data that surpasses 4k.
10:00 tyldis I guess we could store the data and pass a reference via session, and then do the lookup again on subsequent requests
10:01 tyldis But was hoping for something more out of the box. Mojolicious::Plugin::ServerSession didn't give me a warm and fuzzy feeling.
10:02 stephanj becarefull with passing references - it only works on single process servers i.e. morbo
10:03 tyldis reference as in a generated "session id" and we fetch the data from disk
10:03 geospeck Thumbs up guys for this https://mojolicious.io/index.html I am really enjoying it!
10:03 tyldis Not a Perl reference
10:04 stephanj ah that should work ofcourse
10:04 stephanj sorry for assuming the worst!
10:09 tyldis Hehe, no problem.
10:11 tyldis stephanj: For your question, have you tried to debug mojo events and see what events fire during startup?
10:11 stephanj ah a really good idea! no i genuely did not even think about it
10:11 stephanj will try that soon
10:12 tyldis MOJO_EVENTEMITTER_DEBUG=1 is exported in my shell ;)
10:12 tyldis Well, almost at least
10:13 stephanj heh
10:21 PsimanX1 joined #mojo
10:24 S joined #mojo
10:27 kes joined #mojo
10:55 tchaves joined #mojo
11:19 dod joined #mojo
12:08 CandyAngel jberger: There is code chunk under Day 6 "The Controller" which isn't being shown as a code chunk
12:53 vicash joined #mojo
12:55 cng joined #mojo
13:07 CHYC If I have a Minion job with a delay, what's the best way to upsert the same task, potentially changing the delay? Best I can come up with ties me to the pg backend, which to me is a code smell.
13:09 CandyAngel retry with a new delay?
13:09 CandyAngel Or do you want the original one to run as well?
13:11 CHYC No, I'd like to alter the delay essentially for a task  if it exists with same arguments (sorry, should have mentioned that bit before.)
13:11 CHYC If the task doesn't exist, create it.
13:11 sri you can't
13:12 CandyAngel Not without backend shenanigans
13:12 CHYC Bummer
13:13 sri for unique jobs i just enqueue more than one and have a lock to prevent more than one from running
13:13 CHYC sri: Not quite applicable in my case. I'd like to potentially slide the start either direction.
13:14 CHYC I have a working solution and the schema looks relatively stable. I'll just take note of any changes to minion schema.
13:14 sri the minion schema will change
13:14 CHYC sri: Noted, thanks
13:16 CandyAngel How come you want to change the start time?
13:16 CandyAngel Or.. the time it *could* be started
13:23 geospeck joined #mojo
13:24 jberger CandyAngel shows you how tired I was when I published! I actually thought I had given it a good read over for glaring mistakes :/
13:24 CHYC It'd probably be too long and rambling to explain in full the reasons, but essentially each job will cascade to many systems so it's not a case of "run it more than once", but at the same time I want to give users the ability to schedule the task, and crucially alter the start time if one is already queued.
13:25 jberger geospeck I'm glad you like it!
13:25 CandyAngel Sounds like you need something outside Minion to stage the jobs before they are commited to Minion
13:26 CHYC CandyAngel: Right, or I can just query the minion backend.
13:26 CandyAngel Sure. I don't object to that.. totally going to be doing it myself with my Minion project (human workers)
13:27 CandyAngel jberger: Aw.. never mind. It's fixable :P
13:28 kes jberger: Hi. Did I answer your question about disabling cache for embedded app in tests?
13:29 jberger kes I really haven't had any time to think about it
13:30 jberger after our conversation yesterday I $jberger->work(); $jberger->write_blog_post(); $jberger->sleep();
13:30 kes Is my patch looks useful? may I put link into issue on github? Maybe someone later will reuse it.
13:31 pink_mist $jberger->delay($work, $blog, $sleep);
13:31 jberger heh, you think I'm optimizing code now? No this is "write as fast as you can" time ;-P
13:31 pink_mist :P
13:32 jberger kes: have you added tests and documentation?
13:32 jberger I think once that has been done then it is at least worthy of consideration
13:32 jberger I don't know what the resolution of the remaining technical merits will be
13:33 jberger that's all I can tell you at the moment
13:33 Afristar jberger: About the issue from yesterday: I have used your code and it works like a charm. However I have found that some radio stations are marked as dead because I am not reading any data from them (but they are alive). I have used MOJO_USERAGENT_DEBUG to get the debug info, so I will take this as homework and try to figure out what is going on. If I really can´t figure it out I will ask you for help if that is okay. :)
13:33 jberger CandyAngel: gah! old-school markdown is 4 space indented
13:34 jberger Afristar: if it waits one read cycle before sending data then mine would likely fail yes
13:34 jberger you might make it allow a couple chunks before giving up
13:35 jberger it was a quick first try anyway
13:35 Afristar jberger: Should I use a counter for that? (That is my first idea)
13:35 jberger (hmmmm, I wonder if there's a blog post in that code)
13:35 jberger yeah, that's what I'd do
13:35 jberger play around with it, have fun
13:35 Afristar Will do. Thanks. :)
13:36 kes thank you jberger
13:36 dod joined #mojo
13:36 gizmomathboy joined #mojo
13:37 CandyAngel jberger: Meaningful whitespace strikes again!
13:38 maschine jberger++ thanks for the calendar posts - I started reading them last night and already learned a couple new things. :)
13:40 jberger maschine glad to hear it!
13:40 jberger CandyAngel: I really much prefer github-flavored markdown with code fences
13:41 sri re migration directories in Mojo::Pg, the only clean way to add it would require all SQL snippets to be loaded into memory
13:41 jberger but statocles doesn't allow that (yet!)
13:41 sri i wonder if that would actually be counter productive
13:43 dod joined #mojo
13:43 sri guess i might not add the feature after all
13:44 jberger why would loading the sql statements be counter productive? I don't see the downside to that?
13:44 sri single file migrations at least encourage smaller SQL snippets
13:44 jberger (but I'm pretty tired)
13:44 sri jberger: people might not realize that all smippets end up in memory
13:45 jberger oh so just footprint
13:45 sri yes
13:45 jberger do they need to be loaded if not automigrating and not actually migrating?
13:45 jberger if you could defer it, that's not such a bad thing
13:46 sri can't defer it with the current api
13:46 sri too late for that
13:48 jberger wow, a nigerian prince email actually made it through my gmail this morning!
13:49 jberger that hasn't happened in a long time!
13:49 tyldis Then it's legitimate
13:49 tyldis ONly reasonable conclusion
13:52 tyldis Best way to implement "fire off this sub at this date and time"? Setting a timer x seconds into the future feel like abuse when we are talking about 2-3 days.
13:52 sri guess i'll just push the branch i made yesterday since i won't finish it anyway
13:53 sri in case someone else wants to finish it https://github.com/kraih/mojo-pg/compare/migration_dir
14:09 maschine how do I stop a subprocess from running if I do a redirect for an error?
14:09 maschine I did a redirect, but I get "Mojo::Reactor::EV: I/O watcher failed: Connection already closed "
14:18 ChmEarl joined #mojo
14:27 bwf joined #mojo
15:01 gryphon joined #mojo
15:05 geospeck joined #mojo
15:17 chandwki joined #mojo
15:54 Afristar Can I detect/check a connection timeout in Mojo?
16:05 jberger from your end or the remote end?
16:05 jberger there is an event on the mojo end
16:06 jberger from the remote end it is just a connection close
16:15 Afristar Solved it using $tx->error->{message} eq "Connect timeout"
16:46 bwf Is Mojo::Role a delegation pattern?  Just trying to understand.
16:49 CandyAngel bwf: I don't believe so. I think it actually generates a new package for the role'd objects to be part of
16:49 CandyAngel It uses Role::Tiny, which calls something called: create_class_with_roles
16:50 CandyAngel So yeah.. I think that is what it does :)
16:52 haarg CandyAngel: that's what the built in role support does.  Mojo::Role is different.
16:56 CandyAngel I don't see anything in Mojo::Role's code that says it does anything different.. :\
16:57 CandyAngel I mean, aside from making 'has' work..?
16:58 haarg 'use Mojo::Role;' creates has and imports Role::Tiny, turning the package into a role.
16:58 haarg 'use Mojo::Role -with;' imports with from Role::Tiny, so you can do 'with "Some::Role";' which composes the role.  it doesn't create a new class.
17:05 Grinnz don't use Mojo::Role. it was renamed to Mojo::RoleTiny and Mojo::Role could possibly be used by core in the future
17:05 Grinnz would be nice if the existing Mojo::Role got a tombstone release or something but
17:05 Dandre left #mojo
17:06 Grinnz anyway, you can usually just use Mojo::Base -role or Role::Tiny directly
17:06 lodin joined #mojo
17:07 Grinnz Mojo::Base -role will import Role::Tiny and give you a has function for attributes
17:10 Afristar Woo. The radio monitor with the improved code (it looks a lot less clumsy now :P) is in production and working like a charm. I´ll let this run for a while to see if I have covered all cases.
17:11 CandyAngel Afristar++
17:13 CandyAngel Ah, so I did some refactoring on my server code last night.. but it didn't work out. Looks like I should have split our the "Transaction" bit first..
17:13 CandyAngel split out*
17:13 Grinnz stephanj: there is no event when the server starts, but if you add a next_tick callback in startup, it will run whenever the event loop starts, which will occur when each worker process is started
17:13 Grinnz this is used in https://metacpan.org/source/DBOOK/Mojolicious-Plugin-SetUserGroup-0.005/lib/Mojolicious/Plugin/SetUserGroup.pm#L31
17:20 jamesaxl joined #mojo
17:20 stephanj Grinnz: thank you! that will also work
17:28 sh14 joined #mojo
17:35 dod joined #mojo
17:47 geospeck joined #mojo
17:53 dod1 joined #mojo
17:56 jberger Afristar back to the timeout, do you want to prevent the timeout, if so you could set it to 0
17:57 jberger alternatively if you subscribe to the timeout event on the stream you wouldn't have to string compare the error message
17:57 jberger but anyway, congrats on prod, very nice
18:15 tyldis Does Mojo::IOLoop::Client work with UDP given I provide it a IO::Socket:IP handle that is UDP?
18:17 Grinnz i don't think so
18:18 tyldis :/
18:19 preaction is that what Mojo::IOLoop::Stream is for?
18:19 tyldis Aha!
18:20 * tyldis cuddles preaction and writes a test
18:20 tyldis Otherwise I guess AnyEvent::Handle::UDP can work
18:20 tyldis But trying streams
18:20 pink_mist ugh, AE :(
18:20 Grinnz Stream is for pipes i think, i dunno
18:21 Grinnz I would use IO::Async::Socket
18:21 tyldis Gocha. Doing some tests
18:22 pink_mist stream should work with any handle afaik
18:22 Grinnz right, you just have to parse the packet headers yourself
18:23 Grinnz which https://metacpan.org/pod/NetPacket::UDP can help with
18:23 Grinnz but maybe not in streaming data
18:23 pink_mist really? isn't that done on the OS level?
18:23 tyldis I doubt so, but thanks for the tip
18:23 pink_mist or at least IO::Socket::IP level
18:23 Grinnz oh, yeah
18:28 tyldis Stream is dandy, does the job perfectly
18:29 tchaves joined #mojo
18:29 tyldis At least as client, assume it will for server too
18:34 tyldis Indeed it does.
18:39 Afristar jberger: Can a UserAgent subscribe to Mojo::IOLoop::Stream´s timeout event?
18:40 Grinnz anything can subscribe to any event
18:41 Grinnz you just have to have the stream around to call ->on...
18:41 gizmomathboy joined #mojo
18:45 Afristar But do I have a stream? I can´t remember making a stream anywhere, unless Mojo::UserAgent makes a stream.
18:59 Grinnz i *think* you can retrieve it with my $stream = Mojo::IOLoop->stream($tx->connection)
19:00 Grinnz but only after the connection has been made of course
19:00 Grinnz if you want to set it up before a connection has been made you can use the connection event on the transaction: https://metacpan.org/pod/Mojo::Transaction#connection
19:03 Grinnz that whole thing is a bit of a rabbit hole to dive into...
19:04 trone joined #mojo
19:16 Seth joined #mojo
19:22 Afristar I have noticed some servers close the connection (resulting in a Prematurely closed connection error from Mojo) if you try to connect over HTTP. If I try to connect to the same server (over HTTP) then magically I am going to the same site over HTTPS, but Firefox Dev Tools don´t say I was redirected. Did something else happen, something that causes Mojo not to ¨see¨ a redirect?
19:28 Afristar Could this be related to the web server rewriting HTTP to HTTPS, not resulting in a redirect?
19:40 Grinnz no, it can't do that
19:41 Grinnz it's usually the browser respecting something like https://www.sentinelstand.com/article/http-strict-transport-security-hsts-canonical-www-redirects
20:03 Afristar Mojo does not handle HSTS? Understandable if it doesn´t.
20:05 Afristar Grinnz, I think you are right. The server that Mojo can´t connect to has a line in SiteSecurityServiceState.txt in my Firefox Profile.
20:05 Afristar That explains why I don´t see a redirect in my dev tools.
20:35 ccakes joined #mojo
20:36 diegok joined #mojo
21:47 Leffe joined #mojo
21:50 sri i'll add the sql_for method though https://github.com/kraih/mojo-pg/commit/45bca9b05e7500e0a5804129119b371432ef34e5
21:50 sri it's good for debugging
22:27 itaipu joined #mojo
22:29 bit_shifter joined #mojo
22:50 mcsnolte joined #mojo
22:54 Leffe joined #mojo
23:23 tinita joined #mojo
23:23 tinita joined #mojo
23:24 Leffe joined #mojo
23:34 kiwiroy joined #mojo
23:43 UncleCarl joined #mojo

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