Skip to content

Commit

Permalink
[elasticsearch/client] use bluebird for promises for better backward …
Browse files Browse the repository at this point in the history
…compat
  • Loading branch information
spalger committed Feb 5, 2016
1 parent d5e76b0 commit 1e507a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/plugins/elasticsearch/lib/expose_client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import elasticsearch from 'elasticsearch';
import _ from 'lodash';
import Bluebird from 'bluebird';
const readFile = (file) => require('fs').readFileSync(file, 'utf8');
import util from 'util';
import url from 'url';
Expand Down Expand Up @@ -44,6 +45,9 @@ module.exports = function (server) {
plugins: options.plugins,
apiVersion: options.apiVersion,
keepAlive: options.keepAlive,
defer: function () {
return Bluebird.defer();
},
log: function () {
this.error = function (err) {
server.log(['error', 'elasticsearch'], err);
Expand Down
4 changes: 4 additions & 0 deletions src/ui/public/utils/__tests__/scanner.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import Scanner from 'ui/utils/scanner';
import expect from 'expect.js';
import Bluebird from 'bluebird';
import elasticsearch from 'elasticsearch-browser';
import sinon from 'sinon';

var es = new elasticsearch.Client({
host: 'http://localhost:9210',
defer: function () {
return Bluebird.defer();
}
});


Expand Down
5 changes: 4 additions & 1 deletion test/fixtures/scenario_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ function ScenarioManager(server) {
// NOTE: some large sets of test data can take several minutes to load
this.client = new elasticsearch.Client({
host: server,
requestTimeout: 300000
requestTimeout: 300000,
defer: function () {
return Promise.defer();
}
});
}

Expand Down

0 comments on commit 1e507a9

Please sign in to comment.