test('priority', async () => { delayCount = 0; const result = await Promise.all([ queue.executeInQueue('delay', `11`, { delay: 600, result: '1' }, 1), queue.executeInQueue('delay', `12`, { delay: 100, result: '2' }, 0), queue.executeInQueue('delay', `13`, { delay: 100, result: '3' }, 10) ]); expect(parseInt(result.find(f => f[0] === '3'), 10) % 10).toBeLessThan(2); });
async tablesSchema() { const tables = await this.query(`show tables in ${this.config.dbName}`); return { [this.config.dbName]: (await Promise.all(tables.map(async table => { const tableName = table.tab_name || table.tableName; const columns = await this.query(`describe ${this.config.dbName}.${tableName}`); return { [tableName]: columns.map(c => ({ name: c.col_name, type: c.data_type })) }; }))).reduce((a, b) => ({ ...a, ...b }), {}) }; }
async renderChoices() { if (this.state.submitted) return ''; let choices = this.visible.map(async(ch, i) => await this.renderChoice(ch, i)); let visible = await Promise.all(choices); if (!visible.length) visible.push(this.styles.danger('No matching choices')); return visible.join('\n'); }
async process() { try { let issues = await Promise.all(this.repositories.map(async repository => await this.getIssues(repository))); issues = issues.filter(issueArray => issueArray.length > 0).flat().flat(); const groupedIssues = this.groupIssues(issues); const bot = new BotService(this.context); await bot.sendData(groupedIssues); } catch ({ message }) { this.context.error(message) } }
@Delete(`${APIPrefix}/users/signout`) async signout(@CurUser() user) { if (!user) { return {}; } await Promise.all([ this.redisService.delCache(util.format(this.redisService.cacheKeys.userToken, user.id)), this.redisService.delCache(util.format(this.redisService.cacheKeys.user, user.id)), ]); return {}; }
@Put(`${AdminAPIPrefix}/articles/allverifyfail/:userID`) @Roles(UserRole.Editor, UserRole.Admin, UserRole.SuperAdmin) async allVerifyFail(@Param('userID') userID: number) { await Promise.all([ this.articleService.allVerifyFail(userID), ]); return { }; }
const resetGraphQLCache = async () => { await Promise.all([ parseGraphQLServer.parseGraphQLController.cacheController.graphQL.clear(), parseGraphQLServer.parseGraphQLSchema.databaseController.schemaCache.clear(), ]); }
async deleteFile(filename: string) { const bucket = await this._getBucket(); const documents = await bucket.find({ filename }).toArray(); if (documents.length === 0) { throw new Error('FileNotFound'); } return Promise.all( documents.map((doc) => { return bucket.delete(doc._id); }) ); }
Promise.all([ r .table('usersNotifications') .indexCreate('userIdAndEntityAddedAt', [ r.row('userId'), r.row('entityAddedAt'), ]) .run(conn), ]).catch(err => { console.log(err); throw err; })
test('do not buffer stdout when `buffer` set to `false`', async t => { const promise = execa('max-buffer', ['stdout', '10'], {buffer: false}); const [result, stdout] = await Promise.all([ promise, getStream(promise.stdout) ]); t.is(result.stdout, undefined); t.is(stdout, '.........\n'); });
Promise.all( objects.slice(0, 3).map(async obj => { const originalFieldValue = obj.get('someField'); await expectAsync( deleteObject(obj.className, obj.id, { 'X-Parse-Session-Token': user4.getSessionToken(), }) ).toBeRejectedWith(jasmine.stringMatching('Object not found')); await obj.fetch({ useMasterKey: true }); expect(obj.get('someField')).toEqual(originalFieldValue); }) )
Promise.all( objects.map(async obj => expect( ( await getObject(obj.className, obj.id, { 'X-Parse-Master-Key': 'test', }) ).data.get.someField ).toEqual(obj.get('someField')) ) )
async _initializeSchemaAndConfig() { const [schemaController, parseGraphQLConfig] = await Promise.all([this.databaseController.loadSchema(), this.parseGraphQLController.getGraphQLConfig()]); this.schemaController = schemaController; return { parseGraphQLConfig }; }
Promise.all( objects.slice(0, 3).map(obj => expectAsync( getObject(obj.className, obj.id, { 'X-Parse-Session-Token': user4.getSessionToken(), }) ).toBeRejectedWith(jasmine.stringMatching('Object not found')) ) )
Promise.all( allChannelsInCommunity.map(channel => removeMemberInChannel(channel, currentUser.id) ) )