status_length is here at the bottom of the while loop? its being decreased by the -= 1. its the total thats not getting smaller
example....
there is a tweet with a length of 200 the status_length var falls to 0 from 200
a longer 250 tweet then comes in and the status_length var falls to 0 again from 250
a shorter 150 tweet comes in and the status_length var falls to 0 from 250
a tweet with a length of 200 the status_length var falls to 0 from 250
try running the above code for some minutes and watch the shell print numbers?