Fix #12581: Use a deque for connection.queries.