Browse Source
			
			
			Feature/increase timeout to load benchmarks (#3158)
			
				* Increase request timeout
* Update changelog
			
			
				pull/3160/head
			
			
		 
		
			
				
					
						 Thomas Kaul
					
					2 years ago
						Thomas Kaul
					
					2 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: B5690EEEBB952194
						
					
				
			
		
		
		
	
		
			
				 8 changed files with 
14 additions and 
11 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
- 
					
					
					 
					apps/api/src/app/access/access.controller.ts
				
- 
					
					
					 
					apps/api/src/app/admin/admin.controller.ts
				
- 
					
					
					 
					apps/api/src/app/admin/admin.service.ts
				
- 
					
					
					 
					apps/api/src/app/benchmark/benchmark.service.ts
				
- 
					
					
					 
					apps/api/src/app/redis-cache/redis-cache.service.ts
				
- 
					
					
					 
					apps/api/src/app/subscription/subscription.controller.ts
				
- 
					
					
					 
					apps/api/src/app/user/user.controller.ts
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
			
		
	
		
			
				
					|  |  |  | - Improved the usability of the platform management in the admin control panel | 
			
		
	
		
			
				
					|  |  |  | - Improved the usability of the tag management in the admin control panel | 
			
		
	
		
			
				
					|  |  |  | - Improved the exception handling of various rules in the _X-ray_ section | 
			
		
	
		
			
				
					|  |  |  | - Increased the timeout to load benchmarks | 
			
		
	
		
			
				
					|  |  |  | - Upgraded `prisma` from version `5.10.2` to `5.11.0` | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ### Fixed | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -83,7 +83,7 @@ export class AccessController { | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     try { | 
			
		
	
		
			
				
					|  |  |  |       return await this.accessService.createAccess({ | 
			
		
	
		
			
				
					|  |  |  |       return this.accessService.createAccess({ | 
			
		
	
		
			
				
					|  |  |  |         alias: data.alias || undefined, | 
			
		
	
		
			
				
					|  |  |  |         GranteeUser: data.granteeUserId | 
			
		
	
		
			
				
					|  |  |  |           ? { connect: { id: data.granteeUserId } } | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -339,6 +339,6 @@ export class AdminController { | 
			
		
	
		
			
				
					|  |  |  |     @Param('key') key: string, | 
			
		
	
		
			
				
					|  |  |  |     @Body() data: PropertyDto | 
			
		
	
		
			
				
					|  |  |  |   ) { | 
			
		
	
		
			
				
					|  |  |  |     return await this.adminService.putSetting(key, data.value); | 
			
		
	
		
			
				
					|  |  |  |     return this.adminService.putSetting(key, data.value); | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -71,7 +71,7 @@ export class AdminService { | 
			
		
	
		
			
				
					|  |  |  |         ); | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       return await this.symbolProfileService.add( | 
			
		
	
		
			
				
					|  |  |  |       return this.symbolProfileService.add( | 
			
		
	
		
			
				
					|  |  |  |         assetProfiles[symbol] as Prisma.SymbolProfileCreateInput | 
			
		
	
		
			
				
					|  |  |  |       ); | 
			
		
	
		
			
				
					|  |  |  |     } catch (error) { | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -110,7 +110,9 @@ export class BenchmarkService { | 
			
		
	
		
			
				
					|  |  |  |     const quotes = await this.dataProviderService.getQuotes({ | 
			
		
	
		
			
				
					|  |  |  |       items: benchmarkAssetProfiles.map(({ dataSource, symbol }) => { | 
			
		
	
		
			
				
					|  |  |  |         return { dataSource, symbol }; | 
			
		
	
		
			
				
					|  |  |  |       }) | 
			
		
	
		
			
				
					|  |  |  |       }), | 
			
		
	
		
			
				
					|  |  |  |       requestTimeout: ms('30 seconds'), | 
			
		
	
		
			
				
					|  |  |  |       useCache: false | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     for (const { dataSource, symbol } of benchmarkAssetProfiles) { | 
			
		
	
	
		
			
				
					|  |  | @ -163,7 +165,7 @@ export class BenchmarkService { | 
			
		
	
		
			
				
					|  |  |  |       await this.redisCacheService.set( | 
			
		
	
		
			
				
					|  |  |  |         this.CACHE_KEY_BENCHMARKS, | 
			
		
	
		
			
				
					|  |  |  |         JSON.stringify(benchmarks), | 
			
		
	
		
			
				
					|  |  |  |         ms('4 hours') / 1000 | 
			
		
	
		
			
				
					|  |  |  |         ms('2 hours') / 1000 | 
			
		
	
		
			
				
					|  |  |  |       ); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -21,7 +21,7 @@ export class RedisCacheService { | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   public async get(key: string): Promise<string> { | 
			
		
	
		
			
				
					|  |  |  |     return await this.cache.get(key); | 
			
		
	
		
			
				
					|  |  |  |     return this.cache.get(key); | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   public getQuoteKey({ dataSource, symbol }: UniqueAsset) { | 
			
		
	
	
		
			
				
					|  |  | @ -29,15 +29,15 @@ export class RedisCacheService { | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   public async remove(key: string) { | 
			
		
	
		
			
				
					|  |  |  |     await this.cache.del(key); | 
			
		
	
		
			
				
					|  |  |  |     return this.cache.del(key); | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   public async reset() { | 
			
		
	
		
			
				
					|  |  |  |     await this.cache.reset(); | 
			
		
	
		
			
				
					|  |  |  |     return this.cache.reset(); | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   public async set(key: string, value: string, ttlInSeconds?: number) { | 
			
		
	
		
			
				
					|  |  |  |     await this.cache.set( | 
			
		
	
		
			
				
					|  |  |  |     return this.cache.set( | 
			
		
	
		
			
				
					|  |  |  |       key, | 
			
		
	
		
			
				
					|  |  |  |       value, | 
			
		
	
		
			
				
					|  |  |  |       ttlInSeconds ?? this.configurationService.get('CACHE_TTL') | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -116,7 +116,7 @@ export class SubscriptionController { | 
			
		
	
		
			
				
					|  |  |  |     @Body() { couponId, priceId }: { couponId: string; priceId: string } | 
			
		
	
		
			
				
					|  |  |  |   ) { | 
			
		
	
		
			
				
					|  |  |  |     try { | 
			
		
	
		
			
				
					|  |  |  |       return await this.subscriptionService.createCheckoutSession({ | 
			
		
	
		
			
				
					|  |  |  |       return this.subscriptionService.createCheckoutSession({ | 
			
		
	
		
			
				
					|  |  |  |         couponId, | 
			
		
	
		
			
				
					|  |  |  |         priceId, | 
			
		
	
		
			
				
					|  |  |  |         user: this.request.user | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -135,7 +135,7 @@ export class UserController { | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     return await this.userService.updateUserSetting({ | 
			
		
	
		
			
				
					|  |  |  |     return this.userService.updateUserSetting({ | 
			
		
	
		
			
				
					|  |  |  |       userSettings, | 
			
		
	
		
			
				
					|  |  |  |       userId: this.request.user.id | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
	
		
			
				
					|  |  | 
 |