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

IRC log for #mojo, 2017-02-27

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

All times shown according to UTC.

Time Nick Message
01:15 polettix joined #mojo
01:15 aborazmeh joined #mojo
01:46 inokenty-w joined #mojo
01:53 ronsavage I found away around the issue. I put successive calls to Ajax-using functions inside the done() part of prior Ajax calls, so they operate sequentially.
01:53 ronsavage left #mojo
02:36 khamsin joined #mojo
03:22 noganex joined #mojo
05:04 dboehmer_ joined #mojo
06:14 eseyman joined #mojo
06:48 Vandal joined #mojo
07:59 AndrewIsh joined #mojo
08:06 ashimema joined #mojo
08:23 trone joined #mojo
08:33 coolo sri: if you have a minute ... I can't get the streaming working. I only get the blob when the loop is through :(
08:34 coolo I want a huge json array generated and read element by element by javascript
08:36 coolo ah, render_later might be the trick
08:36 * coolo loves how talking in this channel always brings a solution :)
08:37 stephan48 the question problem. the solution is asking a question. the problem will solve itself afterwards. either someone replies or in the moment after you hit send you find it yourself :)
08:38 coolo but the real problem is that I need to return to the ioloop if I want parts to be written
08:39 coolo the documentation of chunked transfer does only mention it indirectly
08:40 coolo (I guess - it's still not working)
08:40 stephan48 can you link it to me?
08:42 stephan48 my first wild shot would be to wrap the calls for rendering the loop entries in a Mojo::IOLoop->next_tick or a timer with 0 passed as delay.
08:42 stephan48 this should help give the ioloop some time to work on sending the stuff out
08:44 coolo stephan48: the app I'm working on is not public, no. But I'll try your suggestions
08:44 stephan48 ah sorry, i was meaning a link to the documentation
08:44 coolo I'm talking about http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Chunked_transfer_encoding
08:45 stephan48 http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Timers - here is an example for write_chunk using a recurring timer. i think it will lead to the same as i proposed
08:45 stephan48 do you nest the loop calls?
08:45 stephan48 or just call write_chunk repeatedly?
08:47 stephan48 i think i did the latter in one of my apps some long time ago. it did not work out too well.
08:47 * coolo so far does for i in @bigarray { write_chunk(process($i)) }
08:47 stephan48 ah
08:48 stephan48 yea that will never give the eventloop time to send it as far as i understand it
08:48 stephan48 the next_tick/timer trick might work well even without the drain callback
08:49 stephan48 utilizing that is a bit tricky in loops
08:50 * coolo is moving the inner part of the loop into a callback so I can call the next loop run as drain callback of the previous
08:53 rshadow joined #mojo
08:58 coolo ok, this doesn't seem to work recursively
08:58 coolo nah, stupid me
08:59 rshadow joined #mojo
09:02 kivilahtio joined #mojo
09:03 coolo ok, it did work
09:03 coolo the only problem left is that the stream does not close
09:03 coolo back to the docu :)
09:04 coolo ->finish
09:05 coolo stephan48: thx
09:06 stephan48 you are welcome :)
09:08 dod joined #mojo
09:47 sugar joined #mojo
10:01 user_ok joined #mojo
10:18 sugar joined #mojo
10:52 * sri sneezes some more
10:57 CHYC sri: Gesundheit :)
11:12 coolo sri: got some mojo hacking alergy? :)
11:30 rshadow joined #mojo
11:38 rshadow joined #mojo
11:43 sugar joined #mojo
11:45 sri coolo: just old fashioned flu
11:45 kes joined #mojo
11:45 * sri sneezes again
11:46 coolo sri: I still find it a bit suspicious that you fall sick as soon as you hack on mojo for more than 3 days in a row :)
11:47 sri seriously... first time i'm really sick in like 2 years... and it's during hackweek
11:50 sri well, at least UNIX domain sockets are done now
11:50 sri pelase review btw. https://github.com/kraih/mojo/compare/v7.26...master
11:51 sri will release later if there are no complaints
11:54 good_news_everyon joined #mojo
11:54 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vyIy1
11:54 good_news_everyon mojo/master 23803ac Sebastian Riedel: no need to keep the path around
11:54 good_news_everyon left #mojo
11:54 dod joined #mojo
11:57 coolo how can I finish a websocket server-side without getting an error in the javascript console? Do I need to send a custom message for the client to close first?
11:58 coolo I get 'failed: Close received after close'
12:00 sri $c->finish
12:00 sri sends a close frame
12:03 coolo I have that - so I need to look for a client side
12:04 aborazmeh joined #mojo
12:06 coolo https://github.com/jarohen/chord/issues/36
12:07 sri use MOJO_WEBSOCKET_DEBUG=1 to see what actually goes over the wire
12:07 sri if there's two close frames it's a bug
12:09 coolo I just ignore it
12:10 sri at least leave us a minimal test case
12:13 coolo sri: see the above link - it's a problem of the chrome devtools
12:13 sri coolo: i read the thread, it actually wasn't
12:13 sri further down they fixed it with a commit
12:14 coolo sri: in his client
12:15 coolo the server part was only checked and changed in paranoia mode
12:16 marty joined #mojo
12:16 coolo sri: I even added a send('DONE') before the finish for the client to close first - still the devtools complain if the server closes too
12:16 sri hmm, ok
12:17 sri i suppose you could check with firefox to be 100% sure
12:32 salva joined #mojo
12:35 rshadow joined #mojo
12:44 khfeng joined #mojo
12:51 sugar joined #mojo
12:54 dod joined #mojo
13:09 marty_ joined #mojo
13:18 jabberwok joined #mojo
13:55 bwf joined #mojo
13:56 vicash left #mojo
13:56 gryphon joined #mojo
14:00 gryphon joined #mojo
14:05 vicash joined #mojo
14:14 gizmomathboy joined #mojo
14:19 gryphon joined #mojo
14:19 Pyritic joined #mojo
14:32 sugar joined #mojo
14:40 Pyritic joined #mojo
14:53 foursixnine joined #mojo
15:01 coolo sri: the documentation for WS suggests to use url_for()->to_abs
15:01 coolo but that is using ws://localhost:4000 (as foursixnine had to demonstrate me :)
15:01 coolo how can I fix the base url?
15:02 sri ?
15:03 * coolo is reading http://www.mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Rewriting
15:03 coolo sri: I need the ws:// url behind apache
15:04 sri url_for works on routes, ti changes http to ws for websocket routes
15:05 sri the base is always http or https
15:11 coolo damn. $self->req->url is relative
15:11 coolo but I can't construct ws:// urls as relative path
15:12 sri i mean, you can always do $url->to_abs->scheme('ws')
15:12 coolo but only if mojo knows the proxy's server name
15:12 coolo because the to_abs is what getting me localhost:4000
15:13 sri well, of course, otherwise the proxy is configured wrong
15:13 coolo (which tragically only worked for my own testing :)
15:13 sri has to pass through the Host header
15:13 sri and you activate proxy support in the mojo server
15:13 sri no wait, that's not needed for Host :)
15:14 sri all the cookbook recipes have the Host header handling
15:14 coolo "host" => [
15:14 coolo "localhost:4000"
15:14 coolo ],
15:14 coolo that's from req->headers
15:14 sri yea, it's wrong
15:14 coolo but I have a  "x-forwarded-host"
15:14 sri the apache or nginx needs to be fixed
15:15 sri x-forwarded-host is not supported in mojolicious, since it's pretty much pointless
15:15 coolo ProxyPreserveHost On ?
15:15 sri yea
15:16 pink_mist that's part of the apache mod_proxy config in the cookbook, yea
15:16 sri proxy_set_header Host $host; for nginx
15:18 coolo now it works
15:18 sri :)
15:18 sugar joined #mojo
15:19 coolo foursixnine: ^^ :)
15:27 mcsnolte joined #mojo
15:29 coolo ... in chromium, firefox says can't connect
15:29 * foursixnine tries in firefox again
15:31 foursixnine coolo, does not work, but shows the url to the ws at least :)
15:54 gregf_ joined #mojo
15:56 pWr joined #mojo
16:04 good_news_everyon joined #mojo
16:04 good_news_everyon [mojo] kraih created reactor_debug (+1 new commit): https://git.io/vyLlX
16:04 good_news_everyon mojo/reactor_debug 0c06b69 Sebastian Riedel: show reactor timing information when MOJO_REACTOR_DEBUG=1 is set
16:04 good_news_everyon left #mojo
16:05 sri btw. that was the idea behind my reactor diagnostics experiments
16:05 sri it went nowhere, but maybe it can inspire someone else
16:06 sri it basically stores a callstack for every timer/io watcher callback, and prints it when the callback runs, and keeps track of how much time is spent in the callback
16:07 sri the big problem is information overload
16:07 sri the data itself is good, but when there's multiple timers running every second you just can't keep track
16:10 sri https://gist.github.com/anonymous/6ca3772d7425fcd1a6a2ce421d676d75
16:13 sri i mean, it does help finding out where a slow callback came from
16:13 sri if you sleep 1 that will quickly add up in the time spent data
16:15 sri i'll keep the branch around for inspiration
16:18 jberger any progress in that area is nice
16:18 jberger I keep thinking about how to improve diagnostics in the ioloop
16:18 jberger but I keep coming at if from other realms
16:18 jberger like a wrapper that returns a callback but with a stack trace from the point that the callback was created
16:19 jberger and then does something with that (which is where I lose the thread of what I'm doing and how and then give up again for a few months)
16:21 castaway joined #mojo
16:23 sh14 joined #mojo
16:36 kes joined #mojo
16:39 miller joined #mojo
16:48 stryx` joined #mojo
17:02 good_news_everyon joined #mojo
17:02 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vyL2D
17:02 good_news_everyon mojo/master ce2d983 Sebastian Riedel: bump version
17:02 good_news_everyon left #mojo
17:12 lluad joined #mojo
17:13 rshadow joined #mojo
17:18 stryx` joined #mojo
17:22 sugar joined #mojo
17:45 gryphon joined #mojo
18:02 PopeF0 joined #mojo
18:16 stryx` joined #mojo
18:36 rshadow joined #mojo
18:43 PryMar56 joined #mojo
19:01 sugar joined #mojo
19:02 asarch joined #mojo
19:16 gizmomathboy joined #mojo
19:20 bwf joined #mojo
19:25 ajr_ joined #mojo
19:30 ajr_ joined #mojo
19:36 ajr_ joined #mojo
20:04 gizmomathboy joined #mojo
20:25 zenon joined #mojo
21:20 CandyAngel joined #mojo
21:22 CandyAngel with regards to Mojo::Log, is $log->history "allowed" to give more than $log->max_history_size entries in return? The extra ones are only pruned when the next message is received..
21:27 irqq joined #mojo
21:33 CandyAngel It's not a problem, I'm just curious
21:35 rshadow joined #mojo
21:51 nic CandyAngel: How does that happen?  Did you set max_history_size to a smaller value?
21:51 CandyAngel Yeah
21:51 CandyAngel (I have h and H to decrease/increase log size respectively)
21:52 nic I see
21:52 Grinnz yeah, probably wasn't designed for that to dynamically change
21:53 CandyAngel yeah.. it's really cool though :)
21:53 nic :)
21:53 PopeF0 joined #mojo
21:53 Grinnz maybe a check could be added to ->history, that would be up to a proposal
21:55 nic The thing is, Mojo::Log is so amenable to subclassing
21:55 CandyAngel That's true
21:56 CandyAngel https://ibin.co/3DsbUTQGzclY.png
21:56 Grinnz I already tend to use this simple subclass by default https://metacpan.org/pod/Mojo::Log::Clearable
21:59 nic nice.  might need to steal some of that for Mojar::Log
22:04 tudorconstantin joined #mojo
22:05 nic I'm very interested in reactor_debug
22:05 nic this week I'm crazy-busy, but hopefully I can have a play next week
22:05 CandyAngel Oh yeah, I know what i need to do
22:05 CandyAngel I need to subclass it so repeated items are grouped together somehow
22:06 marty joined #mojo
22:06 nic with a count of how many times each entry occurred?
22:06 CandyAngel Yeah
22:06 nic cool
22:06 sri nic: i think the biggest problem is the verbosity of the stack trace
22:06 CandyAngel Otherwise, debug is useless when $log->debug is called on every frame draw :P
22:07 nic sri: I'm thinking of it like a maths problem... at some point someone hits on a novel way to summarise or slice or visualise
22:08 tudorconstantin hi ... thanks @sri and @Grinnz for the quick review of my pull request. Is there some way I could modify and improve it in order to increase its chances of being accepted? like explicitly setting the default secret in the conf for example, so it wouldn't disable the warning?
22:09 nic marcus: There's a graph I think you were favourable of, which shows the amount of time (or perhaps number of calls) in a call stack
22:09 nic the name might be something related to fire or lava
22:10 CandyAngel flame graph?
22:10 pink_mist flame graphs are awesome
22:10 pink_mist Devel::NYTProf can make them for you
22:10 nic CandyAngel++   # nail+head
22:10 CandyAngel http://www.brendangregg.com/FlameGraphs/cpu-mysql-updated.svg
22:10 CandyAngel As I have been playing The Long Dark recently, flame graphs are indeed awesome :P
22:11 sri well, if you just want to collect data at runtime and then visualize it later things get easier
22:11 jberger Devel::NYTProf has those now too IIRC
22:11 CandyAngel It does
22:11 pink_mist jberger: I already said =)
22:11 jberger oh, you did, my bad
22:11 sri that's not what i was looking for though
22:11 sri i wanted runtime diagnostics
22:12 nic ah, understood.  I'm wanting to do a time-bounded test and then analyse afterwards
22:12 sri but sure, make a custom backend that generates a database with statsm then have a command line tool to make pretty graphs :)
22:13 nic (thanks for sharing the branch)
22:13 sri Devel::IOLoopProf ;p
22:13 CandyAngel Thanks for the comments and pointers. Back to coding game engine \o/
22:14 CandyAngel Because it is somewhat more interesting than accounting :P
22:15 Grinnz tudorconstantin: setting a secret in the conf is what disables the warning
22:15 Grinnz this needs to be an action the user does themselves
22:15 Grinnz not automatic
22:20 tudorconstantin I see, what if I put some dummy params in the sample config file?
22:21 zenon Is it too sketchy to rely on my captures having a naming scheme?
22:22 CandyAngel left #mojo
22:22 jberger what about something like $self->app->secrets( $config->{secrets} ) if defined $config->{secrets};
22:22 zenon I wanna map from params to my actions to calls to fetch stuff from an api ... will it be a pain in the ass if my code just splits the match name?
22:22 itaipu joined #mojo
22:23 tudorconstantin jberger: my pull request also created the config file, and it had some secrets preconfigured, so if the dev was not changing it, it would've remained with them enabled
22:24 tudorconstantin and without the warnings
22:24 jberger right, I'd be opposed to that too
22:24 jberger but if you generate the config file with a comment in it about setting secrets (and not make default ones for them)
22:25 tudorconstantin I made the pull request because it took me about 10 minutes to figure out how to enable and use the config mechanism
22:25 zenon Why not generate a config file that has something "fairly" secret, like the date the app was generated and the pid of the script?
22:26 tudorconstantin zenon: that sounds pretty good to me
22:37 tudorconstantin or, another solution, to not include secrets in the sample config file at all, but something else, like a dummy connection string to an imaginary db
22:39 zenon There's no point in the sample config having a secret in it, because it can't be a secret, and any value it did have would need to trigger the same message, really.
22:40 * zenon still isn't sure when to use a comma.
22:47 marty joined #mojo
23:05 orev joined #mojo
23:22 PopeF joined #mojo
23:30 sugar joined #mojo

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