Might as well benefit from a little parallelism.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4611 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "type": "tildefriends-app",
 | 
			
		||||
  "emoji": "🐌",
 | 
			
		||||
  "previous": "&tx4iQew0sHvZW3YAEx8y2Qr8m+MhoNdxs/5+1Rx4s7Y=.sha256"
 | 
			
		||||
  "previous": "&rMCwJnENRN/cYxMPF06+r0dlKVyFFuL3fziFjG14oN4=.sha256"
 | 
			
		||||
}
 | 
			
		||||
@@ -65,10 +65,10 @@ class TfTabNewsFeedElement extends LitElement {
 | 
			
		||||
					this.hash.substring(1),
 | 
			
		||||
				]);
 | 
			
		||||
		} else {
 | 
			
		||||
			let messages = [];
 | 
			
		||||
			const k_following_limit = 2048;
 | 
			
		||||
			let promises = [];
 | 
			
		||||
			const k_following_limit = 256;
 | 
			
		||||
			for (let i = 0; i < this.following.length; i += k_following_limit) {
 | 
			
		||||
				messages = messages.concat(await tfrpc.rpc.query(
 | 
			
		||||
				promises.push(tfrpc.rpc.query(
 | 
			
		||||
					`
 | 
			
		||||
						WITH news AS (SELECT messages.*
 | 
			
		||||
						FROM messages
 | 
			
		||||
@@ -97,7 +97,7 @@ class TfTabNewsFeedElement extends LitElement {
 | 
			
		||||
						new Date().valueOf() + 24 * 60 * 60 * 1000,
 | 
			
		||||
					]));
 | 
			
		||||
			}
 | 
			
		||||
			return messages;
 | 
			
		||||
			return [].concat(...(await Promise.all(promises)));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user