Use an Integer instead of an Array for error count.

Using array for error count consumes lots of memory when
retry_limit is large. We don't use an item in @error_history,
so we can use simply number count instead of array based approach.

@frsyuki Could you check this PR?