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

IRC log for #mojo, 2017-03-23

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

All times shown according to UTC.

Time Nick Message
00:39 dave joined #mojo
00:52 lluad joined #mojo
01:09 aborazmeh joined #mojo
01:57 disputin joined #mojo
02:10 kiwiroy joined #mojo
02:54 _dave_ joined #mojo
03:00 Janos joined #mojo
03:26 mishanti1 joined #mojo
03:29 noganex joined #mojo
03:30 ningu joined #mojo
03:35 ningu is there any simple way to disable session cookies for a particular request?
03:35 ningu I don't want to actually disable the session store. just not parse the cookie and not return one
03:35 pink_mist use a different, new UA for that request?
03:36 ningu sorry, should have been clearer. I mean from within mojo. I want a particular route to not have access to session data and not return a cookie for a session
03:36 ningu it should have access to session data it sets on its own, though.
03:37 pink_mist I don't think that's doable
03:37 pink_mist though
03:37 pink_mist cookies do have a path attribute
03:37 pink_mist which you may be able to make use of
03:38 ningu where is the code that actually loads the session from the cookie called?
03:38 ningu s/called/located/
03:39 ningu maybe lazily on $c->session
03:40 ningu hrm... I could do a local on the cookie_path perhaps
03:41 ningu that is too hackish
03:41 ningu I'll fool around a bit
04:01 disputin joined #mojo
04:01 ningu also, is there a way to run a particular route/sub before the regular route handlers run?
04:02 ningu well
04:03 ningu oh I see. before_dispatch hook
05:04 dboehmer_ joined #mojo
05:25 inokenty-w joined #mojo
06:34 Vandal joined #mojo
06:35 someguy joined #mojo
06:36 someguy Does it make sense for a controller to load a plugin, am I forced to have them in startup?
06:38 someguy it seems like it might be a good idea to load OAuth and other AAA plugins from my login controller, for example.
06:43 ningu left #mojo
06:46 marcus joined #mojo
06:49 marcus _dave_: was just a leftover from my debugging your script.
06:59 dod joined #mojo
07:00 dexteruk joined #mojo
07:01 dexteruk Hi, everyone quick question.  I have a websocket and i would like to change the div layout so my plan was to use a template containing the new layout and use jquery to .load the template file
07:02 dexteruk but the .load function does not load the file form the public, it sends a get function
07:04 dexteruk so i added GET /layouts/:file and served the file via $c->reply->static but the .load seems to not like it as after that is see a second GET /layouts/undefined
07:04 dexteruk any ideas?
07:09 dexteruk when i do a get in the browser http://domain/layouts/test.html it serves the page
07:11 cng sounds like a jquery issue; gist your code
07:16 dexteruk is there another way to implement templates with websockets
07:16 cng separate issues
07:18 cng you can transfer any data with websocket, then do what you like with it in browser. How are you handling templates in the browser, mustache? something else? Or are you rendering template on mojo side and sending html via websocket?
07:18 cng Really need more context to give suggestions
07:43 kiwiroy joined #mojo
07:44 AndrewIsh joined #mojo
07:53 prg joined #mojo
07:56 marcus joined #mojo
08:02 foursixnine joined #mojo
08:06 kiwiroy joined #mojo
08:12 dexteruk cng: hi im renderng the template on mojo side and sending html via the websocket
08:13 dexteruk basically the get / opens the index.html that loads the ws
08:13 dexteruk script
08:14 dexteruk then the server side sends data via the websocket server via /message which is an emitter
08:14 dexteruk that links the data to the correct ws key
08:15 hertzhaft_ joined #mojo
08:16 trone joined #mojo
08:32 osfabibisi joined #mojo
09:20 rshadow joined #mojo
09:29 aborazmeh joined #mojo
09:53 osfabibi_ joined #mojo
10:05 kiwiroy joined #mojo
10:11 aborazmeh_ joined #mojo
10:16 hertzhaft joined #mojo
10:32 hertzhaft joined #mojo
10:41 hertzhaft_ joined #mojo
10:49 hertzhaft joined #mojo
11:07 irqq joined #mojo
11:25 hertzhaft joined #mojo
11:33 hertzhaft joined #mojo
11:40 hertzhaft joined #mojo
12:28 stryx` joined #mojo
13:02 zivester joined #mojo
13:34 tchaves joined #mojo
13:36 marty joined #mojo
13:36 marty joined #mojo
13:40 Pyritic joined #mojo
13:41 gryphon joined #mojo
13:47 dantti_laptop|2 joined #mojo
14:30 Janos joined #mojo
14:50 sri hmm, protecting the minion worker from oomkiller is kind of a tricky problem
14:51 sri with the whole fork new process for every job model it's kind of intended to have runaway job processes get killed by the oomkiller
14:52 sri but jobs inherit the value of /proc/<pid>/oom_score_adj from their parent by default, and systemd only has a setting for the parent
14:53 sri this appears to work, testing it in production now https://gist.github.com/anonymous/2e851cc3789ac55c00cf5f2dad29a092
14:54 sri the start event runs right after the job process has been forked, but before the task code gets to work
14:55 sri kinda interesting, a process is allowed to increase the value, but not decrease without root permissions
14:57 sri the value can be between -2000 and 2000, with 0 being the default and processes with higher values getting killed first by oomkiller
14:58 sri figured i'd mention it so it gets preserved in the irclog :)
14:58 sri someone is bound to stumble over the same problem
15:52 sh14 joined #mojo
15:55 PryMar56 joined #mojo
16:00 sri guess everybody is busy already playing mass effect andromeda
16:00 sri ;p
16:10 jabberwok simutrans here
16:11 jberger jabberwok aren't you supposed to be writing a talk?! don't tell me its already done?!
16:11 sri haha
16:26 jabberwok pfft, mere background tasks.  the game, i mean.
16:26 jabberwok at least i have a laptop (netbook) again, one with a hdmi output this time
16:33 disputin joined #mojo
17:10 hertzhaft left #mojo
17:14 kgoess joined #mojo
17:53 marty_ joined #mojo
17:54 marty_ joined #mojo
18:14 stryx` joined #mojo
18:21 kiwiroy joined #mojo
18:34 dod joined #mojo
18:42 rshadow joined #mojo
19:06 rshadow joined #mojo
19:08 FROGGS joined #mojo
19:30 marty joined #mojo
19:31 marty joined #mojo
20:24 irqq joined #mojo
20:34 warbl joined #mojo
21:15 disputin joined #mojo
21:18 PopeFelix So... can someone explain to me the idea behind doing things asynchronously with Mojo::IOLoop and friends? I realize that's a broad question.
21:19 Grinnz yeah... you just basically asked what the point of food is :P
21:19 PopeFelix lol
21:19 PopeFelix I'm trying to come up with a decent example
21:19 preaction as opposed to... doing something synchronously?
21:20 PopeFelix So I have some code, and in the middle of it, there's some long-running operation. Conventionally, I'd do <code> <long operation> <code>.
21:20 Grinnz synchronous code: one statement runs, wait for it to complete, next statement runs. asyncrhonous code: one statement sets up things for the event loop to watch, next statement runs, event loop runs callbacks when appropriate
21:20 PopeFelix Right, and I get that, at least I think I do.;
21:20 Grinnz the thing to note is that you can't directly convert one to the other very easily
21:20 Grinnz it has to be built that way
21:21 tchaves joined #mojo
21:22 PopeFelix But if I need the output of the long-running operation in my example to continue the rest of my program flow, is there any point to doing it asynchronously?
21:22 Grinnz the rest of your program flow would be triggered by the callbacks from the event loop. various mechanisms make this easier, like delays or futures
21:22 PopeFelix And I've been playing with Futures.
21:23 Grinnz but any code that comes after the setup step, and not in the callback, will run before all that completes
21:23 PopeFelix OK, that makes sense.
21:24 Grinnz the point to doing it asynchronously is so that other things you've set up the event loop to watch can fire in the meantime
21:24 Grinnz such as: mojolicious server accepting other requests, etc
21:24 PopeFelix So I guess that I might use asynchronous code if I could separate out the stuff that doesn't depend on the long-running operation.
21:24 Grinnz if the long-running operation is holding up other tasks, then it's worth thinking about
21:25 Grinnz other *unrelated* tasks
21:25 PopeFelix Right.
21:26 PopeFelix OK, cool. That's kind of what I was already thinking, but I wanted someone who was a bit more experienced with this whole asynchronous business to confirm it. :)
21:26 Grinnz also you can't just put the long running operation in the event loop and get a benefit from that, it will still block the event loop while it runs; but you can use Mojo::IOLoop->subprocess to put it in a forked process so it doesn't
21:26 * PopeFelix nods
21:27 Grinnz or if it's a natively async operation like Mojo::UserAgent requests or Mojo::Pg queries then you can use that module's non blocking operation mode
21:27 PopeFelix That's where I'm using it now, with Paws::S3.
21:28 Grinnz right, with the MojoAsyncCaller it can return Futures
21:28 PopeFelix Yep
21:28 Grinnz i'm interested to know how well that works, havent tried it yet
21:29 PopeFelix But those long-running operations - in this case, S3 writes - are still going to block, aren't they?
21:29 PopeFelix once the event loop fires off, I mean.
21:29 Grinnz writing to the server maybe. but not waiting for the server to respond
21:30 PopeFelix OK.
21:30 marty joined #mojo
21:32 PopeFelix I just need to make sure that any code that depends on the server response is in the on_done block (using Futures) or is after an await()
21:33 Grinnz ->then is more common with futures; you get a new future that way, which can be useful
21:33 PopeFelix Yes, I'm using ->then in the tests I'm writing.
21:33 Grinnz i wish the docs made that a bit clearer, but it has a lot to document
21:33 Grinnz once i discovered that i just need to ->then everything, it was easy
21:34 PopeFelix And yeah, I could put that code in on_done() for the resultant future.
21:34 PopeFelix But isn't ->then -ing everything effectively the same as doing things synchronously?
21:34 PopeFelix At least for that chain of Futures.
21:35 Grinnz nope, ->then runs once the initial future completes
21:35 Grinnz returns a new future you can wait on
21:35 Grinnz so you can chain them
21:37 Grinnz e.g. the code in the ->then callback can wait on something else that returns a future, like a subsequent http request
21:37 kiwiroy joined #mojo
21:37 PopeFelix Right, but take: $f1 = something_returning_a_future(); $f2 = $f1->then( ... ); $f3 = $f2->then( ... );
21:38 PopeFelix $f3->on_done won't happen until $f1 and $f2 have finished, right?
21:38 preaction correct
21:38 Grinnz yep, it creates a cause-effect relationship
21:38 PopeFelix ok. so for *that chain*, it's effectively the same as: action_in_f1(); action_in_f2(); action_in_f3();
21:39 nic (a)->(b)->(c) can be better than (a; b; c) because it lets the ioloop do (a)->(x)->(b)->(y)->(c)->(z) instead of (a; b; c)->(x; y; z)
21:39 PopeFelix ohhhhh
21:39 Grinnz yes, except those actions can include the event loop running other things while it waits
21:39 nic where (...) means a sequential blocking block
21:39 preaction like "Accept another incoming socket" and "handle that request while we wait"
21:40 PopeFelix yeah, i think i see now. the ioloop is going to poll, and if whatever it polls doesn't report ready, it'll poll another thing.
21:40 nic now you're it, you have to pass it on  :)
21:40 PopeFelix not me! ;)
21:41 PopeFelix um... circle, circle, dot, dot, now I have my cootie shot? ;)
21:42 * Grinnz still has to write a "Event Loops for Dummies" somewhere
21:43 Grinnz an event loop is like an onion. no wait
21:44 preaction an event loop is like a dog waiting at a hallway of doors. as soon as a door opens, they run over there!
21:46 PopeFelix I like that, preaction . :)
21:49 PopeFelix Now I just have to get pplu to approve my PR.
21:49 PopeFelix :)
22:07 marty joined #mojo
22:25 dikim joined #mojo
22:31 _dave_ sri: are you playing mass effect andromeda?
22:55 hummeleBop joined #mojo
23:06 dave joined #mojo
23:16 _dave_ joined #mojo
23:24 pink_mist hmm, I gotta say I prefer Iron Fist over Luke Cage
23:24 pink_mist that's not really saying too much though
23:24 Grinnz I stil havent had time to watch it yet
23:25 pink_mist just started episode 6
23:26 cng Agreed, IF is more entertaining. LC was too dreary.
23:30 pink_mist I like how it's finally getting more inte *ahem* *cough* never mind, don't want to spoil =)
23:39 _dave_ wow new stuff to watch :)
23:40 cng I’m enjoying enough to save it up for weekend binge watching. ;-)
23:41 _dave_ I liked Luke Cage so I'm hoping my preference isn't completely measurable by a scalar, otherwise I wont like Iron Fist
23:43 Grinnz I liked parts of Luke Cage and disliked other parts
23:43 Grinnz Would have been great if diamondback was removed entirely
23:43 genio I'm lost on TV shows for a few weeks while we have college basketball crazy to watch :)
23:44 irqq_ joined #mojo
23:44 _dave_ hm diamonback I thought was essential..but you all have to remember I read the original comics
23:44 Grinnz right, would probably be better with that context
23:45 _dave_ remember Luke Cage was part of the same blaxplotiation drive as created Shaft
23:45 _dave_ waaay back before most of you were born ;)
23:47 _dave_ so that context is important too, said context is meaningless in today's day and age
23:48 _dave_ On a somewhat related subject, do people here know there's a new Star Trek series coming?
23:48 Grinnz yea, heard about that
23:48 _dave_ I went back on netflix and started looking at the "Enterprise" series (around 2004?) that I'd avoided previously
23:48 _dave_ it wasn't as bad as I thought it was going to be
23:49 _dave_ except for the theme music lol
23:49 cng Yeah, keep *hearing* that, WTF is it? Rewatching Enterprise as something to do.
23:49 _dave_ I imagine it won't be out till later in 2017
23:49 Grinnz yeah. I started watching Enterprise too
23:49 Grinnz it's not a terrible series, it's just not very good at being star trek
23:49 _dave_ LOL
23:49 cng That’s why it appears under ‘trending’ ;-)
23:49 _dave_ my thoughts exactly
23:50 Grinnz kind of like how stargate universe was not very good at being stargate
23:50 _dave_ hollywood likes to "reboot" things because they can't find people with good ideas to steal from anymore
23:51 Grinnz it also scores better in their risk/reward formulas
23:51 _dave_ indeed
23:51 _dave_ https://en.wikipedia.org/wiki/Star_Trek:_Discovery ... that's all I know about it

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