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

IRC log for #mojo, 2016-01-17

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

All times shown according to UTC.

Time Nick Message
00:26 punter joined #mojo
00:36 sri travis ci is really slacking with the postgres updates
00:36 nnms joined #mojo
00:40 nnms joined #mojo
00:46 binlei joined #mojo
00:51 melo joined #mojo
01:00 jontaylor joined #mojo
01:09 melo joined #mojo
01:19 melo joined #mojo
01:54 melo joined #mojo
02:00 jontaylor joined #mojo
02:57 melo joined #mojo
03:35 disputin joined #mojo
03:39 melo1 joined #mojo
03:50 noganex_ joined #mojo
04:21 c--_ joined #mojo
05:06 melo joined #mojo
05:15 binlei joined #mojo
05:16 skinch joined #mojo
05:17 sh4 joined #mojo
05:52 melo joined #mojo
05:59 kaare joined #mojo
06:07 disputin joined #mojo
06:12 binlei joined #mojo
06:35 binlei joined #mojo
06:48 binlei joined #mojo
07:04 binlei joined #mojo
07:31 binlei joined #mojo
07:50 binlei joined #mojo
08:12 Vandal joined #mojo
08:43 binlei joined #mojo
08:50 binlei joined #mojo
08:55 bpmedley joined #mojo
10:16 sh4 joined #mojo
10:19 dom7 joined #mojo
10:23 dom7 hi, I have a question regarding the usage of mojo useragent with websockets. I implemented a client which connects to a websocket service from the BOSE SoundTouch speaker. How do I get a notification when the speaker isn't available any more? I thought I can handled that with an connection error, but that one isn't raised. here you can find my testcode:
10:23 dom7 http://codepad.org/d1VVS9u2
10:28 dom7 I want to achieve, that the websocket is reconnected after the connection dropped. unfortunately I couldn't find anything about such a functionality in the mojo documentation.
11:09 sue joined #mojo
11:18 binlei joined #mojo
12:16 melo1 joined #mojo
13:15 dom7 joined #mojo
13:21 bowtie_ joined #mojo
13:41 binlei joined #mojo
13:41 bpmedley joined #mojo
13:56 c--__ joined #mojo
14:07 jberger It looks like you've also attached to the finish handler which should definitely get called on connection close
14:08 jberger http://mojolicious.org/perldoc/Mojo/Transaction/WebSocket#finish
14:08 jberger Of course they already left
14:16 bpmedley Frustrating when people leave like that.. :)
14:53 asarch joined #mojo
14:55 kyshtynbai joined #mojo
15:05 melo joined #mojo
15:06 bpmedley Anyone having freenode issues?
15:09 go|dfish bpmedley: fine here. your quitting with 'Max SendQ exceeded' though
15:09 go|dfish sigh, you're
15:09 bpmedley Hrmm.  I hope it's the USB Personal Hotspot connection.  I'll need to get some ethernet cable later.
15:26 skaji joined #mojo
15:53 zivester joined #mojo
16:26 ajr_ joined #mojo
16:26 ivan_ joined #mojo
16:36 bpmedley joined #mojo
16:41 c-- joined #mojo
16:41 dod joined #mojo
16:44 dod joined #mojo
16:44 vicash hello. While using Mojo::Pg where does one write a call to the migrations() function ? Should this be in the Model or in some deployment script that gets invoked when the web-app gets deployed ? So basically, I have a table schema created using SQL in a .sql file that I want to invoke on deployment. Where should this invocation go in the code ? In the startup() function ?
16:45 bpmedley vicash : I like to use a Mojo::Command for migrations
16:46 vicash bpmedley: and this Mojo::Command call can be in the script/myapp ?
16:47 vicash oh i guess I can just keep it as a separate script.
16:47 bpmedley vicash : Yes.  It's an elegant way to argument processing to your app.  So, you would do "$ script/myapp migrate", or somesuch
16:49 vicash bpmedley: thanks. i am looking at Mojolicious::Commands for adding more cmdline options . nice. thanks.
16:57 binlei joined #mojo
16:57 sri this is a bit of a bummer https://github.com/kraih/minion/pull/10#issuecomment-172352317
16:58 sri and, anyone want a lock option in minion? https://github.com/kraih/minion/pull/22
17:00 disputin joined #mojo
17:00 disputin joined #mojo
17:01 sri vicash: there's an example app with  migrations included https://github.com/kraih/mojo-pg/tree/master/examples/blog
17:02 sri note that i don't agree with bpmedley's approach
17:02 sri (which doesn't mean it's wrong, just that i disagree)
17:06 disputin joined #mojo
17:08 disputin joined #mojo
17:10 disputin joined #mojo
17:10 disputin joined #mojo
17:13 disputin joined #mojo
17:13 gryphon joined #mojo
17:19 sri the express.js situation is such a mess
17:20 sri drama https://github.com/strongloop/express/issues/2844
17:20 disputin joined #mojo
17:23 sugar joined #mojo
17:24 abra joined #mojo
17:26 disputin joined #mojo
17:28 disputin joined #mojo
17:37 disputin joined #mojo
17:37 disputin joined #mojo
17:39 sri well, i voted against it https://github.com/kraih/minion/pull/22#issuecomment-172356982
17:40 disputin joined #mojo
17:40 sri disputin: fix your connection
17:41 disputin joined #mojo
17:43 jberger What is the performance hit when not using that feature?
17:44 sri good question, you should ask :)
17:48 disputin joined #mojo
17:48 disputin joined #mojo
18:06 binlei joined #mojo
18:20 sri jberger: don't you have a bigger postgres minion setup?
18:20 sri maybe you can test some combinations of indexes
18:24 sri odd that the addition of the queue made postgres not use the state index
18:24 sri also doesn't like a queue index, of queue+state one
18:24 sri s/of/or/
18:47 jberger Last job had the pg setup
18:47 jberger This one prefers mysql
18:48 jberger And it is a very young project
18:48 jberger Though it is centered on lots of small jobs rather than fewer large ones
18:49 sri aww
19:06 asarch Two questions: I've been using other web servers and, as a matter of fact, any of them is as strong as morbo is (in the sense that you can literally do a division by zero and morbo is still running)
19:07 sri that is a statement that makes no sense, not two questions
19:07 asarch So, is there any way to tell morbo that every error or warning message should save it in a database?
19:07 asarch So you can later easily can debug it
19:08 kyshtynbai joined #mojo
19:09 asarch And, the second question is, when you already have a production environment and you want to add a new feature and you are not certainly sure if it could break something, is there any way to test it before you commit the changes?
19:11 PryMar56 joined #mojo
19:16 jberger asarch: the second question is easier: don't test in production
19:16 jberger you should have a separate environment (at least one, maybe many) to test in
19:16 asarch A copy of the app, right?
19:17 jberger yes and for a first start you can just clone the production database too
19:18 jberger but generally you probably want to write your application such that it is as easy to deploy as possible
19:18 jberger that's good practice in case of say disaster recovery
19:18 jberger and of course to build testing environments
19:18 kyshtynbai Hi guys. How should I propely pass an array reference as a json type? $c->render(json => {_and_here_is_where_i_am_stuck_});
19:18 dom7 joined #mojo
19:18 asarch Is there any module for incremental copies (instead of doing a full dump of the model)?
19:19 dom7 jberger: yes, I registered to the finish handler, but that one is only called if inactivity_timeout is != 0. Is that a bug? Shouldn't it be called when the connection drops as well?
19:21 jberger asarch: since mojo is model agnostic no, there's nothing that I'm aware of
19:21 jberger dom7: I find that very surprising
19:29 jberger dom7: here's a simple test
19:29 jberger perl -Mojo -E 'app->routes->websocket("/" => sub { $_->on(finish => sub { say "finished" }); $_->send("hello") }); app->start' daemon
19:29 jberger then in a browser open the developer tools
19:30 jberger probably need to open a dummy page like chrome://version
19:30 jberger then run: ws = new WebSocket('ws://127.0.0.1:3000'); ws.onopen = function(){ ws.close() }
19:31 jberger in your terminal you'll see "finished"
19:32 dom7 I'm not sure if that is a proper test for my scenario, as I want to test a websocket connection which isn't properly closed but connection disappeared (IP address not available any more). The ws.close() function would properly close the connection instead of terminating it.
19:33 sri you want Mojo::IOLoop->stream($c->tx->connection)->close
19:34 dom7 I'm connecting with websocket to IP:8080 and listening for incoming messages. The messages are properly received, but if I disconnect the IP from the network I don't get any finish/error message in mojo.
19:35 dom7 sri: I don't want to close a connection I just want to get a notification if the IP I'm connected to isn't available any more
19:35 sri for a test case
19:35 sri it's pretty easy to verify if there really is a bug that way
19:36 disputin joined #mojo
19:37 sri if you can make a failing test case we'll have it fixed in no time
19:38 jberger this seems to do what I expect: perl -Mojo -E 'app->routes->websocket("/" => sub { $_->on(finish => sub { say "finished" }); $_->send("hello"); my $tx = $_->tx; Mojo::IOLoop->timer(1 => sub { Mojo::IOLoop->stream($tx->connection)->close }) }); app->start' daemon
19:38 dom7 can you have a look at my code (http://codepad.org/d1VVS9u2) that's the one I'm testing with and I don't get a finish message if I just remove the 192.168.1.168 device from the network. I would image that if I remove the device from the network I should get an immediate finish message
19:41 dom7 jberger: you are calling "close" in that test. In my case the other side just isn't available any more. I'm not sure if that is reflected in your code.
19:42 jberger the close I use there is a low level close that kills the tcp connection
19:42 jberger the only thing is that it does kill it on the server side
19:42 jberger I'm trying to make a client side example now, but its a little more involved
19:43 jberger I don't have the ability to test your exact case, I don't have servers I can just pull the cord out of the wall
19:44 sri lol
19:45 dom7 :) wouldn't a good testcase be to connect to ws://echo.websocket.org and disconnect internet afterwards?
19:45 jberger dom7: again, how?
19:46 Kogurr joined #mojo
19:46 jberger from a perspective of testing in the test suite
19:46 sri this is entirely out of our hands, what happens depends on your operating system
19:47 sri tcp connections can stay open for hours like that
19:47 dom7 sri: so you mean the operating system would drop the tcp connection after some time?
19:48 dom7 that would make sense, I thought that websockets have some kind of "ping/pong" on low level to check the connection state
19:48 dom7 ok, in that case I could work with the inactivity_timeout which works as expected
19:48 jberger they do, but it isn't automater
19:48 jberger automated
19:49 jberger you can send a ping frame and bail if you don't get a pong in return
19:49 jberger then again, IIRC, not all clients do it automagically either
19:49 dom7 ok, in that case I could work with the implemented ping/pong mechanism BOSE provides
19:50 dom7 which is high level messaging
19:50 dom7 but how do I reconnect if the connection drops?
19:51 jberger first check to see that the server responds to the PING frame
19:52 jberger once you have that, them just implement an occaisonal ping with a timeout that reconnects if it doesn't get a pong in a reasonable timeframe
19:53 dom7 ok, I'll try to use the ping frame and check if it works. regarding the reconnect I have no clue at the moment how to implement. do I need to define a new useragent->webscoket(..)?
19:58 dom7 is there nothing like tx->reconnect() what I can use in the finish callback?
20:00 punter joined #mojo
20:02 vicash sri: thanks for the example for migrations
20:02 jberger dom7: no, though I might be interested to see what that would look like, if you wanted to propose it
20:02 jberger dom7: although that only is useful from a client perspective and mojo websocket usage in mojo is likely the server side
20:05 jberger here is an implementation of a reconnecting websocket for a browser (js) client: https://github.com/joewalnes/reconnecting-websocket/blob/master/reconnecting-websocket.js
20:05 dom7 I saw that most of the use cases are server side ones, but it's the only client perl library which works pretty well :) I would only like to have a websocket connection which is always connected and automatically reconnects if inactivity_timeout is reached.
20:05 jberger I don't think that anything that advanced could be considered for mojo core
20:07 dom7 what do you think about auto reconnect on inactivity_timeout and retry on request_timeout?
20:09 dom7 max_retries = 0 (always try to connect and fail on request_timeout)
20:09 dom7 -fail +do next retry
20:19 bpmedley joined #mojo
20:45 sri dom7: you also have to handle failures to reconnect anywhere in the stack, from proxy to endpoint suddenly being plain http
20:47 sri or what about frames still in the buffer when you get disconnected?
20:54 dom7 drop them, due to the message to the user that the connection dropped, it doesn't make sense to have anything on a higher OSI layer still in place. the other side would also need to reinititate the connection from the beginning
20:55 sri omg, strongloop/ibm is the worst
20:55 sri https://github.com/strongloop/loopback/issues/1079
20:56 sri for over a year they kept this line now, even after being made aware of the very real plain http mitm vector https://github.com/strongloop/loopback/blob/master/package.json#L106
20:57 sri and that's the folks that maintain the most popular node.js framework
20:58 kaare_ joined #mojo
21:02 sri dom7: and then you'd have to come up with a plan for recycling the transaction
21:04 absolut_todd joined #mojo
21:05 sri doubt it will ever happen in core, someone would have to put in serious hours to make it nice
21:06 sri (making it a horrible hack is pretty easy though)
21:09 dom7 of course, I just wanted to raise the requirement...for me I will try to setup a completely new connection and reconnect that way for now
21:16 ajr_ joined #mojo
21:24 lsm joined #mojo
21:28 bowtie_ joined #mojo
21:43 sri i just don't see this getting accepted https://github.com/kraih/minion/pull/22
22:07 * sri wonders what number of jobs to optimize minion for by default
22:35 cpan_mojo Minion-4.03 by SRI https://metacpan.org/release/SRI/Minion-4.03
22:36 sri oh well, i'm not gonna put more time into this, if someone wants optimizations they can do the benchmarks themselves ;p
22:48 asarch joined #mojo

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