AjaxDataSource: Stop polling after a certain conditon

I was wondering if I could stop an AjaxDataSource object from polling after some sort of condition has been fulfilled. Any guidance would be helpful.

(link to my stackoverflow post as well: https://stackoverflow.com/questions/48573320/bokeh-ajaxdatasource-end-polling-after-condition)

Also here is the actual file where I am implementing my AjaxDataSource object: https://github.com/hhprogram/PyramidSite/blob/master/webgraphing/views/ajaxView.py