dmitry-solomadin / skwibl

Realtime collaboration service.
http://skwibl.com
1 stars 0 forks source link

Understand why the valums file uploader doesn't work properly with middleware. #91

Closed yuri-karadzhov closed 11 years ago

yuri-karadzhov commented 12 years ago

Valums file uploader which we currently use does,nt work properly with express middleware.

yuri-karadzhov commented 12 years ago

It so happens, that some files doesn't upload. The reason is in how node works with HTTPRequest object and how the node-redis module works. The reason is node redis collect several request for one transaction and then send it to redis-server and at the same time reques 'data' event emited, so it happens that after additional db call 'data' event emits before req.on('data') listener is attached and the data completely missed with no chance to responce to the request ('end' event is lost too). But the WritableStream is created anyway, thats why we have empty files in uploads dirrecory and responce after 30sec timeout.

The solution is - to understand how to make a pause and send the data right in time (after the listener is attached). And it seems req.pause() req.resume() methods can help (but still it doesn't work for me in such simple way).

The other way is to use jQuery File Uploader which use forms instead of request data event and shouldn't have such problems.

yuri-karadzhov commented 11 years ago

We decided to find better file uploader.