[python-ldap] Processing query in spans of time with timeout and resuming

Ondřej Kuzník ondra at mistotebe.net
Tue Jul 5 07:18:08 EDT 2022


On Sat, Jul 02, 2022 at 01:01:35PM +0200, Max Gautier wrote:
> Hi everyone,
> 
> I'm trying to use python-ldap to write a vim completion plugin
> (more specically, a completion source for vim-asyncomplete[1]), and I'm not sure if
> what I want is possible. 
> 
> Basically, I'd like to do launch a LDAP query, and return results either:
> 1. When the query is finished
> 2. After a soft timeout
> With the possibility in the second case to re-loop and each time get the
> results up to now. 
> 
> [...]
> 
> I'm not a very experienced pythonista, so I might have missed something
> obvious, but my search on google on this mailing list were not fruitful,
> so don't hesitate to point me to the obvious solution if there is one.

I guess timelimit is not working for you?

Haven't written any vim plugins, but looking around I don't think you
have much asynchronous capability inside vim. If were your own process,
you could follow the lines of my asyncio wrapper[0] around python-ldap
or extract the fd and do select/pselect() with a timeout you manage.

Regards,
Ondrej

[0]. https://git.openldap.org/openldap/syncmonitor/-/blob/master/syncmonitor/ldap_wrapper.py


More information about the python-ldap mailing list