File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change
1
+ const BATCH_SIZE_IN_CLAUSE = 30 ;
2
+
3
+ module . exports = {
4
+ BATCH_SIZE_IN_CLAUSE ,
5
+ } ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const firestore = require("../utils/firestore");
8
8
const { fetchWallet, createWallet } = require ( "../models/wallets" ) ;
9
9
const { arraysHaveCommonItem } = require ( "../utils/array" ) ;
10
10
const { ALLOWED_FILTER_PARAMS } = require ( "../constants/users" ) ;
11
+ const { BATCH_SIZE_IN_CLAUSE } = require ( "../constants/firebase" ) ;
11
12
const userModel = firestore . collection ( "users" ) ;
12
13
const joinModel = firestore . collection ( "applicants" ) ;
13
14
const itemModel = firestore . collection ( "itemTags" ) ;
@@ -184,9 +185,8 @@ const fetchFilteredUsers = async (usernames = []) => {
184
185
const filterdUsersWithDetails = [ ] ;
185
186
186
187
const groups = [ ] ;
187
- const batchSize = 30 ; // since only 30 comparisons are allowed with the 'in' clause
188
- for ( let i = 0 ; i < usernames . length ; i += batchSize ) {
189
- groups . push ( usernames . slice ( i , i + batchSize ) ) ;
188
+ for ( let i = 0 ; i < usernames . length ; i += BATCH_SIZE_IN_CLAUSE ) {
189
+ groups . push ( usernames . slice ( i , i + BATCH_SIZE_IN_CLAUSE ) ) ;
190
190
}
191
191
192
192
// For each group, write a separate query
You can’t perform that action at this time.
0 commit comments