fix redis concurrency issue in health metrics + remove ongoing status count (#10717)

### Context
For calendar and message sync job health monitoring, we used to
increment a counter in redis cache which could lead to concurrency
issue.

### Solution
- Update to a set structure in place of counter + use sAdd redis method
which is atomic
- Each minute another counter was incremented on a new cache key ->
Update to a 15s window
- Remove ONGOING status not needed. We only need status at job end (or
fail).


###  Potential improvements
- Check for cache key existence before fetching data to avoid useless
call to redis ?

closes https://github.com/twentyhq/twenty/issues/10070
This commit is contained in:
Etienne
2025-03-07 14:41:46 +01:00
committed by GitHub
parent 02a085df4f
commit 96035f0ccf
11 changed files with 203 additions and 251 deletions

View File

@ -959,7 +959,7 @@ export class EnvironmentVariables {
@IsNumber()
@CastToPositiveNumber()
@IsOptional()
HEALTH_MONITORING_TIME_WINDOW_IN_MINUTES = 5;
HEALTH_METRICS_TIME_WINDOW_IN_MINUTES = 5;
@EnvironmentVariablesMetadata({
group: EnvironmentVariablesGroup.Other,