Call BLPOP from a module

18 views
Skip to first unread message

trevor...@gmail.com

unread,
Aug 28, 2017, 2:25:39 PM8/28/17
to Redis DB
Is it possible to call BLPOP from within a module? I've modified helloworld.c and helloblock.c to call BLPOP and it crashes with a signal 11. Calls to LPOP work fine.

Thanks,

Trevor

Itamar Haber

unread,
Aug 28, 2017, 3:16:01 PM8/28/17
to Redis DB
Hello Trevor,

I can't see why you'd want to do that - calling a client-blocking command from a Redis module would block the server indefinitely.

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

trevor...@gmail.com

unread,
Aug 28, 2017, 3:25:44 PM8/28/17
to Redis DB
I'm trying to implement MBRPOPLPUSH (https://github.com/antirez/redis/issues/1785) in a module. My understanding of the helloblock.c code was that it would only block the one client not the whole server. But it isn't clear to me if you can make blocking calls from the module.


On Monday, August 28, 2017 at 2:16:01 PM UTC-5, Itamar Haber wrote:
Hello Trevor,

I can't see why you'd want to do that - calling a client-blocking command from a Redis module would block the server indefinitely.
On Aug 28, 2017 9:25 PM, <trevor...@gmail.com> wrote:
Is it possible to call BLPOP from within a module? I've modified helloworld.c and helloblock.c to call BLPOP and it crashes with a signal 11. Calls to LPOP work fine.

Thanks,

Trevor

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.

David Torres

unread,
Aug 28, 2017, 4:37:50 PM8/28/17
to redi...@googlegroups.com
Hi! 

Maybe not the best solution (I am a newbie on Redis!) , but you could create a thread and issue the BLPOP command,  blocking the client in the main thread. 

When the BLPOP command finishes, you could just resume the client and forward the BLPOP result.
--

David Torres

Reply all
Reply to author
Forward
0 new messages