Ensure that queues do not get too long

Change-Id: Icfb0689a03d5c2db8171ab375eb1ac5371db1aeb