03:51:29  * rmgquit (Remote host closed the connection)
04:51:58  * rmgjoined
04:56:27  * rmgquit (Ping timeout: 245 seconds)
05:45:10  * bajtosjoined
07:30:26  * fabienfjoined
08:18:04  * rmgjoined
08:22:38  * rmgquit (Ping timeout: 255 seconds)
10:02:00  * bajtosquit (Quit: bajtos)
11:20:23  * rmgjoined
11:25:10  * rmgquit (Ping timeout: 264 seconds)
11:34:10  * bajtosjoined
12:03:14  * bajtosquit (Quit: bajtos)
12:18:33  * bajtosjoined
12:20:43  <fabienf>Hi bajtos
12:21:51  <bajtos>fabienf: hey
12:22:04  <bajtos>fabienf: can we chat in two hours or so?
12:22:12  <fabienf>bajtos: sure
12:25:16  * bajtosquit (Quit: bajtos)
13:35:48  * bajtosjoined
13:46:38  <bajtos>fabienf: yt?
13:46:50  <fabienf>hi bajtos!
13:47:29  <fabienf>just checked your email
13:47:36  * piscisaureusjoined
13:48:16  <bajtos>I am running out of time a bit, as I am off for two weeks starting tomorrow.
13:48:25  <fabienf>bajtos: I wish it was easier for me to share more relevant code bits
13:48:33  <bajtos>It would be great if we managed to find a workaround that works for you for the time being
13:48:42  <fabienf>yeah, definitely
13:48:58  <bajtos>regarding sharing code bits … well, let’s see what we can do
13:49:15  <fabienf>let me check, do you have a moment?
13:50:51  <bajtos>sure
13:53:38  <fabienf>bajtos: https://gist.github.com/fabien/fb322d6af76ad5c5349a
13:55:51  <bajtos>cool, let me try to wire that into a simple LB app
13:56:52  <bajtos>If I use “Container” hasMany “Files” and then call “__create_files__” with the beforeCreateHandler of yours, will it make sense?
13:57:05  <bajtos>i.e. is that close to what your app is doing?
13:57:25  <fabienf>yes, exactly
13:58:02  <fabienf>bajtos: updated the gist to not pause/resume there (code still works, but patch still applies)
13:59:22  <bajtos>where is busboy called? from “storage.provider.extractAndProcess”?
14:00:24  <fabienf>yes, need some code bits?
14:00:32  <bajtos>yeah, that would help
14:02:07  <fabienf>bajtos: updated
14:03:09  <fabienf>what I noticed is that file or field events did not fire
14:03:43  <fabienf>however, it did finish (no stalling or errors)
14:15:10  <fabienf>bajtos: regarding your workaround, it's applied to your "Container" right? not "File"?
14:15:30  <bajtos>probably :)
14:15:39  <bajtos>try Container first, possibly both Container and File
14:15:46  <fabienf>I'm trying it on the 'container', but logging from that method, doesn't seem it's being called
14:16:12  <bajtos>that’s weird
14:17:34  <fabienf>bajtos: yes, very weird - not logging from File either
14:18:07  <fabienf>perhaps I'm applying after it already registered as a shared method on the app?
14:18:26  <bajtos>that may be the reason why it does not work
14:20:33  <fabienf>bajtos: applying it to app.loopback.PersistedModel.sharedCtor bombs away, all kinds of errors
14:21:01  <bajtos>hmm.
14:21:12  <bajtos>what version of loopback are you running?
14:21:37  <bajtos>in 2.x, loopback setups a new sharedCtor function for each Model
14:21:58  <bajtos>so when you overwrite PersistedModel.sharedCtor, the override won’t be called for Container
14:22:03  <fabienf>2.x
14:22:18  <bajtos>so what kind of errors are you seing?
14:22:31  <fabienf>weird that there's exceptions being thrown: 'Shared class "Space" has no method handling GET /work/files'
14:23:37  <bajtos>no clue
14:24:09  <bajtos>I have a question regarding your gist: the request for `__create_files__` is a multipart file upload
14:24:17  <bajtos>but the relation method expects JSON body
14:24:58  <fabienf>yes, so what happens in handleFileCreation is that the body is set to the json it expects
14:25:08  <bajtos>ok, I was expecting something like that
14:25:08  <fabienf>not all that great, but it works
14:26:01  <fabienf>the beforeRemote approach is the most flexible in this case, as it doesn't really matter which kind of relation I'm after, for example
14:26:23  <fabienf>that's the reason why I chose this solution
14:28:25  <fabienf>bajtos: if I were to override sharedCtor from a file in /models that should be good timing, no?
14:28:39  <fabienf>it doesn't work though :/ it's not being called
14:30:25  <bajtos>probably not if your model file is doing `var Container = app.models.Container`
14:30:40  <fabienf>it is, yeah
14:30:52  <bajtos>on second though, it should not matter when you override sharedCtor, as long as it is before the first HTTP request is handled
14:36:30  <fabienf>bajtos: would you be against a sharedmethod rest: {} option to explicitly do this?
14:36:51  <bajtos>to explicitly do what?
14:37:08  <fabienf>to enable the pause/resume behavior on a case by case basis
14:37:58  <bajtos>I don’t like it much. We should really find out how is your request resumed() instead of trying to randomly change/fix things
14:39:00  <fabienf>I agree, however, I'm afraid that strong-remoting is parsing data itself (data event) to be able to use the JSON
14:39:33  <bajtos>I believe it’s parsing data only when it is application/json and/or form-data
14:39:35  <fabienf>that's why my patch works at exactly that point, one tick later, strong-remoting will be extracting args
14:40:08  <bajtos>I would expect strong-remoting parses the whole json body before any of the hooks is called
14:40:16  <bajtos>let me check
14:40:20  <fabienf>even worse then
14:40:42  * GWXjoined
14:41:05  <bajtos>well, you can’t have both strong-remoting and beforeHook reading the same stream
14:41:29  <fabienf>I suggest to have an option for now, until there's a better fix (perhaps when you're back in 14 days)
14:41:46  <bajtos>can you do it in your fork for now?
14:41:46  * GWXpart
14:41:52  <fabienf>sure
14:42:10  <bajtos>or what if you implemented a regular express middleware that would read the request stream, save files, do whatever changes you need, and only then let strong-remoting kick in?
14:42:50  <fabienf>bajtos: that's really not an option, my file handling/processing code is fairly elaborate
14:44:01  <fabienf>and I need it to run in front of relations (different kinds, for different models)
14:44:50  <fabienf>looks like I'll be forking forever, which is f*cked up, since it's a nested dependency of LB
14:46:23  <fabienf>bajtos: I'm off for a bit, thanks for looking into it, but I wish we had come to a consensus
14:47:33  <fabienf>I will go through my code once more, to see if there's anything particular going on still, that I'm not aware of triggering premature streaming
14:49:19  <bajtos>I am trying to figure out how to provide a custom sharedCtor, I’ll let you know if I find a working solution
14:49:28  <fabienf>thanks, that'd be great
14:49:32  * GWXjoined
14:49:32  <bajtos>forking loopback is a bad option, we should find a proper solution when I get back
14:49:51  <fabienf>it's the worst option
14:50:18  <GWX>What is the best IRC room to ask questions about Loopback 2.0?
14:50:22  <fabienf>all I know is that the code works flawlessly with 'create', but not '__create__files'
14:50:44  <fabienf>bajtos: have a nice vacation
14:50:50  <bajtos>fabienf: thanks
14:50:55  <bajtos>GWX: #loopback
14:51:01  <bajtos>GWX: but this channel works too
14:52:53  <GWX>bajtos: Thanks. See about the same people in both rooms. Hope someone could answer my question in #loopback.
14:54:33  <fabienf>bajtos: just a quick thought: what if strong-remoting (and the RestAdapter specifically) would be exposed through loopback somehow?
14:54:54  <fabienf>then I can patch RestAdapter.prototype._createPrototypeMethodHandler directly
14:55:14  <bajtos>fabienf: well, you should be able to do something like `require(‘loopback/node_modules/strong-remoting/lib/rest-adapter’)`
14:55:37  <fabienf>yes, I know, but isn't that even more hacky?
14:56:40  <bajtos>fabienf: well, better than forking, right?
14:56:48  <fabienf>it is, yeah
14:56:49  <bajtos>fabienf: the paths are not very likely to change
15:00:45  <bajtos>fabienf: here’s the fix for custom sharedCtor: you need to call `Container.setup()` after you changed sharedCtor
15:01:05  <bajtos>that will re-create remoting metadata using the new sharedCtor
15:01:07  <fabienf>let me check
15:03:42  <fabienf>hmm
15:03:51  <fabienf>doesn't seem to work, it's still not called
15:04:13  <bajtos>let me paste a bit more complex code that worked for me
15:05:58  <bajtos>fabienf: https://gist.github.com/bajtos/26890ece90ef9b81cf53
15:06:39  <fabienf>bajtos: so you're doing it on PersistedModel directly?
15:09:35  <fabienf>bajtos: Uncaught Maximum call stack size exceeded
15:10:13  <bajtos>there is `Model.setup` function that is called whenever a model is subclassed
15:10:26  <bajtos>so I changed that function to inject a custom sharedCtor
15:10:34  <bajtos>but for PersistedModel descendants only
15:10:52  <fabienf>if (!rec) this.setup(true); => infinite loop for me
15:11:13  <fabienf>leaving it out: exceptions
15:12:21  <bajtos>that’s weird. when you leave the last line out, the sharedCtor change is not applied
15:12:33  <bajtos>and since there wasn’t anything else changed, you should not get exceptions
15:12:50  <fabienf>err, failing tests (because the stream is not paused)
15:13:21  <bajtos>try this as the last line in the custom setup fn:
15:13:21  <bajtos>if (rec !== 'stop') this.setup('stop');
15:14:01  <fabienf>still callstack exceeded
15:14:06  <fabienf>huh?
15:14:48  <bajtos>yeah, I don’t understand it either.
15:15:02  <bajtos>well, if you managed to customize _createPrototypeMethodHandler and it works for you, then let’s leave at that
15:15:12  <fabienf>yes, I was just going to say
15:15:17  <fabienf>that is working now
15:15:25  <bajtos>at least something :)
15:15:29  <fabienf>:)
15:15:33  <fabienf>thanks bajtos
15:15:39  <bajtos>you are welcome
15:15:45  <bajtos>I hoped for a better result, but oh well...
15:15:53  <bajtos>fabienf: see you
15:16:01  <fabienf>well, kinda my experience with LB ;)
15:16:13  <fabienf>see you in a couple of weeks
15:16:48  <fabienf>is Raymond around still?
15:18:36  <fabienf>bajtos: final workaround added here: https://gist.github.com/fabien/fb322d6af76ad5c5349a
15:20:02  <bajtos>yes, Raymond should be online at this time of the day
15:20:19  <fabienf>(I meant for the next couple of weeks)
15:20:41  <bajtos>yes, both he and Ritchie should be available
15:20:57  <fabienf>cool, see you then!
16:08:34  * rmgjoined
16:27:47  * bajtosquit (Quit: bajtos)
17:29:59  * rmgquit (Remote host closed the connection)
18:24:16  * rmgjoined
18:36:26  * bajtosjoined
18:37:29  * bajtosquit (Client Quit)
18:37:54  * bajtosjoined
18:39:00  * bajtosquit (Client Quit)
18:39:49  * bajtosjoined
18:46:21  * bajtosquit (Quit: bajtos)
19:52:21  * piscisaureusquit (Quit: ~ Trillian Astra - www.trillian.im ~)
20:04:20  * rmgquit (Remote host closed the connection)
20:07:07  * fabienfquit (Quit: fabienf)
20:33:35  * bajtosjoined
20:34:57  * rmgjoined
20:37:46  * bajtosquit (Client Quit)
20:41:32  * rmgquit (Ping timeout: 255 seconds)
20:57:02  * rmgjoined
21:07:51  * rmgquit (Remote host closed the connection)
21:28:05  * rmgjoined
21:36:33  * rmgquit (Remote host closed the connection)
22:37:01  * rmgjoined
22:41:43  * rmgquit (Ping timeout: 256 seconds)
23:21:07  * Poesghostjoined
23:21:22  <Poesghost>Hello everyone!