luvit-mongodb icon indicating copy to clipboard operation
luvit-mongodb copied to clipboard

Does this work with coroutines using luvit streams?

Open pyrossh opened this issue 8 years ago • 4 comments
trafficstars

Like explained here https://github.com/creationix/redis-luvit#usage

Doesn't seem to work with luvit 2.0

pyrossh avatar Jan 18 '17 05:01 pyrossh

Hi @pyros2097 ,

Sorry, it doesn't support coroutine, currently only callback style is supported, but maybe we can work into it later.

In your reply:

Doesn't seem to work with luvit 2.0

You mean luvit-mongodb or redis-luvit ? luvi-mongodb works here.

cyrilis avatar Jan 18 '17 07:01 cyrilis

I meant luvit-mongodb doesn't work with the latest luvit version. Here is the error I get.

web_1    | '[Info] - Create connection.......'
web_1    | HTTP server listening at http://0.0.0.0:3000/
web_1    | Uncaught Error: [string "/deps/luvit-mongodb/src/init.lua"]:282: attempt to call method 'redbg' (a nil value)
web_1    | stack traceback:
web_1    | 	[string "/deps/luvit-mongodb/src/init.lua"]:282: in function 'handler'
web_1    | 	[string "bundle:deps/core.lua"]:248: in function 'emit'
web_1    | 	[string "bundle:deps/net.lua"]:244: in function <[string "bundle:deps/net.lua"]:243>
web_1    | 	[string "bundle:deps/timer.lua"]:123: in function <[string "bundle:deps/timer.lua"]:119>
web_1    | 	[C]: in function 'run'
web_1    | 	[string "bundle:init.lua"]:52: in function <[string "bundle:init.lua"]:47>
web_1    | 	[C]: in function 'xpcall'
web_1    | 	[string "bundle:init.lua"]:47: in function 'fn'
web_1    | 	[string "bundle:deps/require.lua"]:300: in function <[string "bundle:deps/require.lua"]:265>

My Version,

luvit version: 2.9.1
luvi version: v2.6.1
rex version: 8.37 2015-04-28
libuv version: 1.8.0
ssl version: OpenSSL 1.0.2e 3 Dec 2015, lua-openssl 0.4.1

I got this error when my mongodb was offline.

It works fine when mongodb is online. '[Info] - Database is connected.......'

Anyway I saw the source code your'e using the 'net' library whereas the redis client is using 'coro-net' library. I'll try to port if It seems worth it.

pyrossh avatar Jan 18 '17 08:01 pyrossh

It should not panic when mongodb offline, seems a bug. will fix it later.

I'm not quite familiar with coro-net, so I use net library instead.

cyrilis avatar Jan 18 '17 09:01 cyrilis

Fixed error message, published to lit, please use version @0.0.24. Thanks.

cyrilis avatar Jan 18 '17 09:01 cyrilis