     clearInterval(Notes.interval)
     Notes.interval = setInterval =>
       @refresh()
-    , @polling_interval
+    , @pollingInterval
 
   refresh: ->
     return if @refreshing is true

        @refreshing = false

  ###
  Increase @polling_interval up to 120 seconds on every function call,
  if `shouldReset` has a truthy value, 'null' or 'undefined' the variable
  will reset to @base_polling_interval.

  Note: this function is used to gradually increase the polling interval
  if there aren't new notes coming from the server
  ###
  setPollingInterval: (shouldReset = true) ->
    nthInterval = @base_polling_interval * Math.pow(2, @max_polling_steps - 1)
    if shouldReset
      @polling_interval = @base_polling_interval
    else if @polling_interval < nthInterval
      @polling_interval *= 2

    @initRefresh()


    @view = view
    @noteable_url = document.URL
    @notesCountBadge ||= $(".issuable-details").find(".notes-tab .badge")
    @basePollingInterval = 15000
    @maxPollingSteps = 4

    @cleanBinding()
    @addBinding()
