[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldap_result() timeout zero returns only one result at a time



On 12/02/2015 09:11, Howard Chu wrote:
Mark R Bannister wrote:
So what I'm asking is, what is the best way of achieving the following
workflow:

- start LDAP search
- start loop
- select() on FD, wake me up when there is data to read
- ldap.result() gives me ALL available data, and without waiting for
anything new

The ldap_result() manpage already tells you how things work. In fact, so does the python-ldap documentation. Your loop structure is wrong.

- Attend to other unrelated events
- Go round loop again

You should be coding, instead:

- start LDAP search
- start loop
- select() on FD, wake me up when there is data to read

loop2:
- call ldap.result() with 0 timeout in a loop until it returns 0.

- Attend to other unrelated events
- Go round loop again

Thanks Howard, that kind of makes sense, but not understanding the internal workings of ldap.result(), what's to prevent loop2 taking, say, 5 seconds to complete? This could be a busy worker thread, I can't afford for it to take that much time
out to process a single transaction.

Thanks,
Mark.