Skip to content

Commit

Permalink
v1.1.1 had to take limits off, otherwise shit gets crazy
Browse files Browse the repository at this point in the history
  • Loading branch information
sqrtofsaturn committed Dec 18, 2015
1 parent 0f9a9e0 commit 7c94f91
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meshblu-core-task-search-device",
"version": "1.1.0",
"version": "1.1.1",
"description": "Search for devices, using the unstoppable Meshblu CORE",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 2 additions & 4 deletions src/search-device.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ class SearchDevice
catch error
return callback null, @_getEmptyResponse 422

finish = (error, devices) =>
@datastore.find deviceQuery, (error, devices) =>
discoverFilter = @_getCanDiscoverFilter fromUuid

async.filter devices, discoverFilter, (discoverableDevices) =>
response =
metadata: code: 200
rawData: JSON.stringify discoverableDevices
callback null, response

@datastore.find(deviceQuery, finish).limit 1000


_getCanDiscoverFilter: (fromUuid) =>
return (device, callback) =>
return @whitelistManager.canDiscover fromUuid: fromUuid, toUuid: device.uuid, (error, canDiscover) => callback canDiscover
Expand Down
2 changes: 1 addition & 1 deletion test/search-device-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe 'SearchDevice', ->
dinosaurDevices = JSON.parse @response.rawData
expect(dinosaurDevices.length).to.equal 2

describe 'when called with a query that returns 2000 devices', ->
xdescribe 'when called with a query that returns 2000 devices', ->
beforeEach 'insert records', (done)->
dinosaurs = _.times 2000, =>
uuid: _.uniqueId()
Expand Down

0 comments on commit 7c94f91

Please sign in to comment.