thats bad though. Its a static sleep and it doesn't check the the item has actually left the inventory. there is nothing wrong with the logic, it has to do with how .contains is updating, which is my question
In response to your edit:
that means it will keep trying to deposit it every 50ms, which it takes longer for the item to leave the inventory than that. So in that case it would keep spamming items to deposit until it leaves, which probably takes about a second. 1000/50 is 20, which means that it would spam the deposit 20 or so times until it left, which is very bot like.