Browse Source

fix(ttl): load ApiKeysCleanUpService when api key cleanup is enabled

The bean condition also required sql.ttl.api_keys.ttl to be greater than
zero, but that property is not defined in thingsboard.yml and defaulted to
zero, so the bean was never created and expired API key rows were never
removed.

ApiKeysCleanUpService does not read a retention value: it deletes keys whose
expiration time has already passed. Drop the unused property from the
condition and gate the bean on sql.ttl.api_keys.enabled alone.

Note that cleanup is now active by default on upgrade, since
sql.ttl.api_keys.enabled defaults to true. Expired API keys are already
rejected during authentication, so this only removes the stale rows.
pull/16361/head
Dmytro Artamonov 2 months ago
parent
commit
f9bccf9ef9
  1. 2
      application/src/main/java/org/thingsboard/server/service/ttl/ApiKeysCleanUpService.java

2
application/src/main/java/org/thingsboard/server/service/ttl/ApiKeysCleanUpService.java

@ -13,7 +13,7 @@ import org.thingsboard.server.queue.util.TbCoreComponent;
@Slf4j
@Service
@TbCoreComponent
@ConditionalOnExpression("${sql.ttl.api_keys.enabled:true} && ${sql.ttl.api_keys.ttl:0} > 0")
@ConditionalOnExpression("${sql.ttl.api_keys.enabled:true}")
public class ApiKeysCleanUpService extends AbstractCleanUpService {
public static final String RANDOM_DELAY_INTERVAL_MS_EXPRESSION =

Loading…
Cancel
Save