refactor unread_count polling so it doesn't slam a backed-up server
refactor unread_count polling so it doesn't slam a backed-up server

fixes: CNVS-21942

let's say you had a server that was backed up and
taking a really long time to respond. as is, this
code would bombard it with a bunch of requests
to poll the unread_count.

this changes it so that rather than sending a request
every 30 seconds, it sends a request 30 seconds
*after the last response came back* so it is nice
to a server that is overloaded.

test plan:

* load the new UI and look at the unread count
  in the global nav.
* in another tab/browser, send yourself a new inbox
  message
* within 30 seconds, the original tab you had open
  should indicate that you have a new unread message

Change-Id: I41497cb87e57b997dfb71eb5604ca13f5c6094b6
Reviewed-on: https://gerrit.instructure.com/58477
Reviewed-by: Clay Diffrient <9dff2e5c98626d20d2848250c411e8009465bb87@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <b030d6d6f199f844ec424882be473c2ab9adc93b@instructure.com>
Product-Review: Ryan Shaw <ea3cd978650417470535f3a4725b6b5042a6ab59@instructure.com>

jay3126/canvas-lms,whalejasmine/canvas-lms,venturehive/canvas-lms,sfu/canvas-lms,Jyaasa/canvas-lms,djbender/canvas-lms,Rvor/canvas-lms,sdeleon28/canvas-lms,Rvor/canvas-lms,leftplusrightllc/canvas-lms,skmezanul/canvas-lms,HotChalk/canvas-lms,antoniuslin/canvas-lms,grahamb/canvas-lms,utkarshx/canvas-lms,skmezanul/canvas-lms,SwinburneOnline/canvas-lms,grahamb/canvas-lms,juoni/canvas-lms,greyhwndz/canvas-lms,SwinburneOnline/canvas-lms,fronteerio/canvas-lms,redconfetti/canvas-lms,fronteerio/canvas-lms,HotChalk/canvas-lms,djbender/canvas-lms,whalejasmine/canvas-lms,djbender/canvas-lms,juoni/canvas-lms,efrj/canvas-lms,greyhwndz/canvas-lms,kyroskoh/canvas-lms,tgroshon/canvas-lms,redconfetti/canvas-lms,roxolan/canvas-lms,Jyaasa/canvas-lms,efrj/canvas-lms,whalejasmine/canvas-lms,Rvor/canvas-lms,roxolan/canvas-lms,sdeleon28/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,kyroskoh/canvas-lms,whalejasmine/canvas-lms,tgroshon/canvas-lms,sdeleon28/canvas-lms,redconfetti/canvas-lms,efrj/canvas-lms,jay3126/canvas-lms,kyroskoh/canvas-lms,SwinburneOnline/canvas-lms,roxolan/canvas-lms,sfu/canvas-lms,Rvor/canvas-lms,greyhwndz/canvas-lms,sfu/canvas-lms,utkarshx/canvas-lms,juoni/canvas-lms,venturehive/canvas-lms,djbender/canvas-lms,tgroshon/canvas-lms,kyroskoh/canvas-lms,HotChalk/canvas-lms,grahamb/canvas-lms,sfu/canvas-lms,leftplusrightllc/canvas-lms,antoniuslin/canvas-lms,sdeleon28/canvas-lms,redconfetti/canvas-lms,venturehive/canvas-lms,grahamb/canvas-lms,jay3126/canvas-lms,antoniuslin/canvas-lms,greyhwndz/canvas-lms,utkarshx/canvas-lms,leftplusrightllc/canvas-lms,roxolan/canvas-lms,leftplusrightllc/canvas-lms,antoniuslin/canvas-lms,sfu/canvas-lms,juoni/canvas-lms,fronteerio/canvas-lms,grahamb/canvas-lms,Jyaasa/canvas-lms,fronteerio/canvas-lms,HotChalk/canvas-lms,venturehive/canvas-lms,efrj/canvas-lms,tgroshon/canvas-lms,jay3126/canvas-lms,utkarshx/canvas-lms,SwinburneOnline/canvas-lms,Jyaasa/canvas-lms,skmezanul/canvas-lms,skmezanul/canvas-lms