Commit 56c6c080 authored by Nick Stenning's avatar Nick Stenning

Bump the number of annotations loaded per request to 200

The overhead associated with a single search call is high enough that
loading only 20 annotations at once is too little. In a naive test this
reduces the time take to request about 300 annotations from 5 seconds to
about 800ms (which, IMO, is still far too slow.)
parent b10d7900
...@@ -75,6 +75,7 @@ describe 'WidgetController', -> ...@@ -75,6 +75,7 @@ describe 'WidgetController', ->
describe 'loadAnnotations', -> describe 'loadAnnotations', ->
it 'loads all annotation for a provider', -> it 'loads all annotation for a provider', ->
viewer.chunkSize = 20
fakeCrossFrame.providers.push {entities: ['http://example.com']} fakeCrossFrame.providers.push {entities: ['http://example.com']}
$scope.$digest() $scope.$digest()
loadSpy = fakeAnnotationMapper.loadAnnotations loadSpy = fakeAnnotationMapper.loadAnnotations
......
...@@ -14,11 +14,12 @@ module.exports = class WidgetController ...@@ -14,11 +14,12 @@ module.exports = class WidgetController
$scope.isEmbedded = true $scope.isEmbedded = true
$scope.isStream = true $scope.isStream = true
@chunkSize = 200
loaded = [] loaded = []
_loadAnnotationsFrom = (query, offset) -> _loadAnnotationsFrom = (query, offset) =>
queryCore = queryCore =
limit: 20 limit: @chunkSize
offset: offset offset: offset
sort: 'created' sort: 'created'
order: 'asc' order: 'asc'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment