made retry attempt counter thread safety