better handling with long-running queries in search dialogue and user management

To avoid multiple (slow) queries running and causing inconsistencies with a lot of many users.

@craigpg @bboule