In queues added option to remove first element on addind new if queue is full

When server is not available for a few hours (in my case) sleekxmpp dies trying to reconnect. It dies faster if you are trying to send messages when disconnected.
I've found a solution (highly probable a bad one) - don't allow send queue to overflow. Without maxsize parameter the queue is "unlimited", but physical memory is not (especially on my embedded device). Without maxsize parameter put() will block until a free slot available which is also not a good idea, I think.
So, I created a queue which will drop first element if you try to put an element when queue is full. It works, but I feel there is a better solution.