Avoid filtering messages query by empty in-predicate.

Doing db_session.query(Message).filter(Message.id.in_(ids)) when ids is empty
causes
```
/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/default_comparator.py:33:
SAWarning: The IN-predicate on "message.id" was invoked with an empty sequence.
This results in a contradiction, which nonetheless can be expensive to
evaluate.  Consider alternative strategies for improved performance.```

But we can simply short-circuit instead of doing the query.