Add a max queue size to avoid overfilling memory