UNPKG

kibana-riya

Version:

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic

39 lines (32 loc) 1.16 kB
import FetchProvider from '../fetch'; import SearchStrategyProvider from '../fetch/strategy/search'; import RequestQueueProvider from '../_request_queue'; import LooperProvider from './_looper'; export default function SearchLooperService(Private, Promise, Notifier, $rootScope) { let fetch = Private(FetchProvider); let searchStrategy = Private(SearchStrategyProvider); let requestQueue = Private(RequestQueueProvider); let Looper = Private(LooperProvider); let notif = new Notifier({ location: 'Search Looper' }); /** * The Looper which will manage the doc fetch interval * @type {Looper} */ let searchLooper = new Looper(null, function () { $rootScope.$broadcast('courier:searchRefresh'); return fetch.these( requestQueue.getInactive(searchStrategy) ); }); searchLooper.onHastyLoop = function () { if (searchLooper.afterHastyQueued) return; searchLooper.afterHastyQueued = Promise.resolve(searchLooper.active) .then(function () { return searchLooper._loopTheLoop(); }) .finally(function () { searchLooper.afterHastyQueued = null; }); }; return searchLooper; };