node-asana icon indicating copy to clipboard operation
node-asana copied to clipboard

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

Open ghost opened this issue 8 years ago • 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);
	});

ghost avatar Jun 15 '17 02:06 ghost

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 40ae0c283eda4beb2952b034a9729f06f01c2b05 ?

Any updates on this issue?

arielshulman avatar Dec 04 '17 17:12 arielshulman

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?

arielshulman avatar Dec 09 '17 23:12 arielshulman