Asana/node-asana

endless page iteration when using steams with "limit > 15" option

Opened this issue · 2 comments

The following code executes endlessly. setting the limit parameter to be 15 or lower stops the stream once it's reaches the last results page (internally)

client.tasks.findByProject(1234567,{
opt_fields:'id,name,assignee',limit:16}) //Note the limit is > 15
	.then(function(collection){
		collection.stream().on('data',function(task){
		    console.log(task);
		});
	})
	.catch(function(err){
		console.log(err);
	});

This error happens to me too (by the copy function - client.projects.tasks(project_id)).
when I limit to 15 everythings is fine, otherwise, >15, it gets into infinit loop with last data (task) received.
Maybe it relates to this commit 40ae0c2 ?

Any updates on this issue?

Well. it seems that the magic number of 16 is because highWaterMark of streams is that by default.

it seems that the latest merge that I've mentioned fixed this issue but the npm package has not been updated.

@pspeter3 @slobak maybe you could help?