Add queue size attribute.

I was running into issues with high memory consumption when too many queued events existed.

This PR adds a queue_size attribute.