- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 
                        private async getNewKey(): Promise<string> {
		let i: number = 0;
		let key: string;
		while (i < 50000) {
			key = this.generateKey(MIN_REFERRAL_NAME_LENGTH);
			const inDatabase: number = await ReferralEntity.count({ where: { name: key }, transaction: this._transaction });
			if (inDatabase === 0) {
				const inProcess: boolean = newKeyInProcess.has(key);
				if (!inProcess) {
					newKeyInProcess.add(key);
					break;
				}
			}
			i++;
		}
		return key;
	}
                                 
        
            Тайпскрипт. MIN_REFERRAL_NAME_LENGTH = 3
Как считаете, когда всё приложение встанет колом?
        
        
Комментарии (2) RSS
Добавить комментарий