Browse Source

Fix immediate expiration of portfolio snapshot with errors

pull/7815/head
Thomas Kaul 1 month ago
parent
commit
948a74af4f
  1. 8
      apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.processor.ts

8
apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.processor.ts

@ -82,9 +82,7 @@ export class PortfolioSnapshotProcessor {
const expiration = addMilliseconds( const expiration = addMilliseconds(
new Date(), new Date(),
(snapshot?.errors?.length ?? 0) === 0 this.configurationService.get('CACHE_QUOTES_TTL')
? this.configurationService.get('CACHE_QUOTES_TTL')
: 0
); );
await this.redisCacheService.set( await this.redisCacheService.set(
@ -101,7 +99,9 @@ export class PortfolioSnapshotProcessor {
return snapshot; return snapshot;
} catch (error) { } catch (error) {
this.logger.error(error.message); this.logger.error(
`Portfolio snapshot calculation of user '${job.data.userId}' has failed: ${error.message}`
);
throw new Error(error); throw new Error(error);
} }

Loading…
Cancel
Save